@zerodev/sdk 5.1.11 → 5.1.13
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/README.md +3 -0
- package/_cjs/actions/index.js +3 -1
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/paymaster/estimateGasInERC20.js +26 -0
- package/_cjs/actions/paymaster/estimateGasInERC20.js.map +1 -0
- package/_cjs/clients/decorators/kernel.js +3 -1
- package/_cjs/clients/decorators/kernel.js.map +1 -1
- package/_cjs/types/kernel.js.map +1 -1
- package/_esm/actions/index.js +1 -0
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/paymaster/estimateGasInERC20.js +25 -0
- package/_esm/actions/paymaster/estimateGasInERC20.js.map +1 -0
- package/_esm/clients/decorators/kernel.js +3 -1
- package/_esm/clients/decorators/kernel.js.map +1 -1
- package/_esm/types/kernel.js.map +1 -1
- package/_types/actions/index.d.ts +1 -0
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/paymaster/estimateGasInERC20.d.ts +20 -0
- package/_types/actions/paymaster/estimateGasInERC20.d.ts.map +1 -0
- package/_types/clients/decorators/kernel.d.ts +2 -0
- package/_types/clients/decorators/kernel.d.ts.map +1 -1
- package/_types/types/kernel.d.ts +15 -0
- package/_types/types/kernel.d.ts.map +1 -1
- package/actions/index.ts +6 -0
- package/actions/paymaster/estimateGasInERC20.ts +57 -0
- package/clients/decorators/kernel.ts +11 -1
- package/package.json +1 -1
- package/types/kernel.ts +15 -0
package/README.md
ADDED
package/_cjs/actions/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.signUserOperation = exports.sponsorUserOperation = void 0;
|
|
3
|
+
exports.estimateGasInERC20 = exports.signUserOperation = exports.sponsorUserOperation = void 0;
|
|
4
4
|
var sponsorUserOperation_js_1 = require("./paymaster/sponsorUserOperation.js");
|
|
5
5
|
Object.defineProperty(exports, "sponsorUserOperation", { enumerable: true, get: function () { return sponsorUserOperation_js_1.sponsorUserOperation; } });
|
|
6
6
|
var signUserOperation_js_1 = require("./account-client/signUserOperation.js");
|
|
7
7
|
Object.defineProperty(exports, "signUserOperation", { enumerable: true, get: function () { return signUserOperation_js_1.signUserOperation; } });
|
|
8
|
+
var estimateGasInERC20_js_1 = require("./paymaster/estimateGasInERC20.js");
|
|
9
|
+
Object.defineProperty(exports, "estimateGasInERC20", { enumerable: true, get: function () { return estimateGasInERC20_js_1.estimateGasInERC20; } });
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":";;;AAAA,+EAI4C;AAHxC,+HAAA,oBAAoB,OAAA;AAKxB,8EAI8C;AAH1C,yHAAA,iBAAiB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":";;;AAAA,+EAI4C;AAHxC,+HAAA,oBAAoB,OAAA;AAKxB,8EAI8C;AAH1C,yHAAA,iBAAiB,OAAA;AAKrB,2EAI0C;AAHtC,2HAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.estimateGasInERC20 = void 0;
|
|
4
|
+
const utils_1 = require("permissionless/utils");
|
|
5
|
+
const index_js_1 = require("../../accounts/index.js");
|
|
6
|
+
const estimateGasInERC20 = async (client, args) => {
|
|
7
|
+
const response = await client.request({
|
|
8
|
+
method: "stackup_getERC20TokenQuotes",
|
|
9
|
+
params: [
|
|
10
|
+
{
|
|
11
|
+
chainId: client.chain?.id,
|
|
12
|
+
userOp: (0, utils_1.deepHexlify)(args.userOperation),
|
|
13
|
+
tokenAddress: args.gasTokenAddress,
|
|
14
|
+
entryPointAddress: args.entryPoint ?? index_js_1.KERNEL_ADDRESSES.ENTRYPOINT_V0_6
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
const result = {
|
|
19
|
+
maxGasCostToken: response.maxGasCostToken,
|
|
20
|
+
tokenDecimals: response.tokenDecimals
|
|
21
|
+
};
|
|
22
|
+
const amount = Number(result.maxGasCostToken) / 10 ** Number(result.tokenDecimals);
|
|
23
|
+
return { amount };
|
|
24
|
+
};
|
|
25
|
+
exports.estimateGasInERC20 = estimateGasInERC20;
|
|
26
|
+
//# sourceMappingURL=estimateGasInERC20.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimateGasInERC20.js","sourceRoot":"","sources":["../../../actions/paymaster/estimateGasInERC20.ts"],"names":[],"mappings":";;;AAIA,gDAAkD;AAElD,sDAA0D;AAsBnD,MAAM,kBAAkB,GAAG,KAAK,EACnC,MAA8B,EAC9B,IAAkC,EACG,EAAE;IACvC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,6BAA6B;QACrC,MAAM,EAAE;YACJ;gBACI,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,EAAY;gBACnC,MAAM,EAAE,IAAA,mBAAW,EACf,IAAI,CAAC,aAAa,CACW;gBACjC,YAAY,EAAE,IAAI,CAAC,eAAe;gBAClC,iBAAiB,EACb,IAAI,CAAC,UAAU,IAAI,2BAAgB,CAAC,eAAe;aAC1D;SACJ;KACJ,CAAC,CAAA;IAEF,MAAM,MAAM,GAAkC;QAC1C,eAAe,EAAE,QAAQ,CAAC,eAAe;QACzC,aAAa,EAAE,QAAQ,CAAC,aAAa;KACxC,CAAA;IAED,MAAM,MAAM,GACR,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;IAEvE,OAAO,EAAE,MAAM,EAAE,CAAA;AACrB,CAAC,CAAA;AA5BY,QAAA,kBAAkB,sBA4B9B"}
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.kernelAccountClientActions = exports.zerodevPaymasterActions = void 0;
|
|
4
4
|
const permissionless_1 = require("permissionless");
|
|
5
5
|
const index_js_1 = require("../../actions/index.js");
|
|
6
|
+
const estimateGasInERC20_js_1 = require("../../actions/paymaster/estimateGasInERC20.js");
|
|
6
7
|
const sponsorUserOperation_js_1 = require("../../actions/paymaster/sponsorUserOperation.js");
|
|
7
8
|
const zerodevPaymasterActions = (client) => ({
|
|
8
|
-
sponsorUserOperation: async (args) => (0, sponsorUserOperation_js_1.sponsorUserOperation)(client, args)
|
|
9
|
+
sponsorUserOperation: async (args) => (0, sponsorUserOperation_js_1.sponsorUserOperation)(client, args),
|
|
10
|
+
estimateGasInERC20: async (args) => (0, estimateGasInERC20_js_1.estimateGasInERC20)(client, args)
|
|
9
11
|
});
|
|
10
12
|
exports.zerodevPaymasterActions = zerodevPaymasterActions;
|
|
11
13
|
const kernelAccountClientActions = ({ sponsorUserOperation }) => (client) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../../clients/decorators/kernel.ts"],"names":[],"mappings":";;;AAAA,mDAA8E;AAQ9E,qDAA0D;AAC1D,6FAIwD;
|
|
1
|
+
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../../clients/decorators/kernel.ts"],"names":[],"mappings":";;;AAAA,mDAA8E;AAQ9E,qDAA0D;AAC1D,yFAIsD;AACtD,6FAIwD;AAejD,MAAM,uBAAuB,GAAG,CACnC,MAAc,EACe,EAAE,CAAC,CAAC;IACjC,oBAAoB,EAAE,KAAK,EAAE,IAAoC,EAAE,EAAE,CACjE,IAAA,8CAAoB,EAAC,MAAgC,EAAE,IAAI,CAAC;IAChE,kBAAkB,EAAE,KAAK,EAAE,IAAkC,EAAE,EAAE,CAC7D,IAAA,0CAAkB,EAAC,MAAgC,EAAE,IAAI,CAAC;CACjE,CAAC,CAAA;AAPW,QAAA,uBAAuB,2BAOlC;AA8BK,MAAM,0BAA0B,GACnC,CAAC,EAAE,oBAAoB,EAAkC,EAAE,EAAE,CAC7D,CAOI,MAAiD,EACA,EAAE,CAAC,CAAC;IACrD,GAAG,IAAA,oCAAmB,EAAC,EAAE,oBAAoB,EAAE,CAAC,CAAC,MAAM,CAAC;IACxD,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CACxB,IAAA,4BAAiB,EAAC,MAAM,EAAE;QACtB,GAAG,IAAI;QACP,oBAAoB;KACuB,CAAC;CACvD,CAAC,CAAA;AAjBO,QAAA,0BAA0B,8BAiBjC"}
|
package/_cjs/types/kernel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../types/kernel.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../types/kernel.ts"],"names":[],"mappings":";;;AA6GA,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,oCAAmB,CAAA;IACnB,sCAAqB,CAAA;IACrB,sCAAqB,CAAA;AACzB,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB"}
|
package/_esm/actions/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EAGvB,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EACH,iBAAiB,EAGpB,MAAM,uCAAuC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EAGvB,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EACH,iBAAiB,EAGpB,MAAM,uCAAuC,CAAA;AAE9C,OAAO,EACH,kBAAkB,EAGrB,MAAM,mCAAmC,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { deepHexlify } from "permissionless/utils";
|
|
2
|
+
import { KERNEL_ADDRESSES } from "../../accounts/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
5
|
+
*/
|
|
6
|
+
export const estimateGasInERC20 = async (client, args) => {
|
|
7
|
+
const response = await client.request({
|
|
8
|
+
method: "stackup_getERC20TokenQuotes",
|
|
9
|
+
params: [
|
|
10
|
+
{
|
|
11
|
+
chainId: client.chain?.id,
|
|
12
|
+
userOp: deepHexlify(args.userOperation),
|
|
13
|
+
tokenAddress: args.gasTokenAddress,
|
|
14
|
+
entryPointAddress: args.entryPoint ?? KERNEL_ADDRESSES.ENTRYPOINT_V0_6
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
const result = {
|
|
19
|
+
maxGasCostToken: response.maxGasCostToken,
|
|
20
|
+
tokenDecimals: response.tokenDecimals
|
|
21
|
+
};
|
|
22
|
+
const amount = Number(result.maxGasCostToken) / 10 ** Number(result.tokenDecimals);
|
|
23
|
+
return { amount };
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=estimateGasInERC20.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimateGasInERC20.js","sourceRoot":"","sources":["../../../actions/paymaster/estimateGasInERC20.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAkB1D;;GAEG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACnC,MAA8B,EAC9B,IAAkC,EACG,EAAE;IACvC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,6BAA6B;QACrC,MAAM,EAAE;YACJ;gBACI,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,EAAY;gBACnC,MAAM,EAAE,WAAW,CACf,IAAI,CAAC,aAAa,CACW;gBACjC,YAAY,EAAE,IAAI,CAAC,eAAe;gBAClC,iBAAiB,EACb,IAAI,CAAC,UAAU,IAAI,gBAAgB,CAAC,eAAe;aAC1D;SACJ;KACJ,CAAC,CAAA;IAEF,MAAM,MAAM,GAAkC;QAC1C,eAAe,EAAE,QAAQ,CAAC,eAAe;QACzC,aAAa,EAAE,QAAQ,CAAC,aAAa;KACxC,CAAA;IAED,MAAM,MAAM,GACR,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;IAEvE,OAAO,EAAE,MAAM,EAAE,CAAA;AACrB,CAAC,CAAA"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { smartAccountActions } from "permissionless";
|
|
2
2
|
import { signUserOperation } from "../../actions/index.js";
|
|
3
|
+
import { estimateGasInERC20 } from "../../actions/paymaster/estimateGasInERC20.js";
|
|
3
4
|
import { sponsorUserOperation } from "../../actions/paymaster/sponsorUserOperation.js";
|
|
4
5
|
export const zerodevPaymasterActions = (client) => ({
|
|
5
|
-
sponsorUserOperation: async (args) => sponsorUserOperation(client, args)
|
|
6
|
+
sponsorUserOperation: async (args) => sponsorUserOperation(client, args),
|
|
7
|
+
estimateGasInERC20: async (args) => estimateGasInERC20(client, args)
|
|
6
8
|
});
|
|
7
9
|
export const kernelAccountClientActions = ({ sponsorUserOperation }) => (client) => ({
|
|
8
10
|
...smartAccountActions({ sponsorUserOperation })(client),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../../clients/decorators/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAQ9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAGH,oBAAoB,EACvB,MAAM,iDAAiD,CAAA;
|
|
1
|
+
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../../clients/decorators/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAQ9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAGH,kBAAkB,EACrB,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAGH,oBAAoB,EACvB,MAAM,iDAAiD,CAAA;AAexD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACnC,MAAc,EACe,EAAE,CAAC,CAAC;IACjC,oBAAoB,EAAE,KAAK,EAAE,IAAoC,EAAE,EAAE,CACjE,oBAAoB,CAAC,MAAgC,EAAE,IAAI,CAAC;IAChE,kBAAkB,EAAE,KAAK,EAAE,IAAkC,EAAE,EAAE,CAC7D,kBAAkB,CAAC,MAAgC,EAAE,IAAI,CAAC;CACjE,CAAC,CAAA;AA8BF,MAAM,CAAC,MAAM,0BAA0B,GACnC,CAAC,EAAE,oBAAoB,EAAkC,EAAE,EAAE,CAC7D,CAOI,MAAiD,EACA,EAAE,CAAC,CAAC;IACrD,GAAG,mBAAmB,CAAC,EAAE,oBAAoB,EAAE,CAAC,CAAC,MAAM,CAAC;IACxD,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CACxB,iBAAiB,CAAC,MAAM,EAAE;QACtB,GAAG,IAAI;QACP,oBAAoB;KACuB,CAAC;CACvD,CAAC,CAAA"}
|
package/_esm/types/kernel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../types/kernel.ts"],"names":[],"mappings":"AAIA,OAAO,EAA6C,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../types/kernel.ts"],"names":[],"mappings":"AAIA,OAAO,EAA6C,MAAM,MAAM,CAAA;AAyGhE,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,oCAAmB,CAAA;IACnB,sCAAqB,CAAA;IACrB,sCAAqB,CAAA;AACzB,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { sponsorUserOperation, type SponsorUserOperationParameters, type SponsorUserOperationReturnType } from "./paymaster/sponsorUserOperation.js";
|
|
2
2
|
export { signUserOperation, type SignUserOperationParameters, type SignUserOperationReturnType } from "./account-client/signUserOperation.js";
|
|
3
|
+
export { estimateGasInERC20, type EstimateGasInERC20Parameters, type EstimateGasInERC20ReturnType } from "./paymaster/estimateGasInERC20.js";
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EACpB,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACtC,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EACH,iBAAiB,EACjB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EACnC,MAAM,uCAAuC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EACpB,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACtC,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EACH,iBAAiB,EACjB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EACnC,MAAM,uCAAuC,CAAA;AAE9C,OAAO,EACH,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACpC,MAAM,mCAAmC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { UserOperation } from "permissionless/types/userOperation.js";
|
|
2
|
+
import type { Address, Hex } from "viem";
|
|
3
|
+
import type { ZeroDevPaymasterClient } from "../../clients/paymasterClient.js";
|
|
4
|
+
export type EstimateGasInERC20Parameters = {
|
|
5
|
+
userOperation: UserOperation;
|
|
6
|
+
gasTokenAddress: Hex;
|
|
7
|
+
entryPoint?: Address;
|
|
8
|
+
};
|
|
9
|
+
export type GetERC20TokenQuotesReturnType = {
|
|
10
|
+
maxGasCostToken: string;
|
|
11
|
+
tokenDecimals: string;
|
|
12
|
+
};
|
|
13
|
+
export type EstimateGasInERC20ReturnType = {
|
|
14
|
+
amount: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
18
|
+
*/
|
|
19
|
+
export declare const estimateGasInERC20: (client: ZeroDevPaymasterClient, args: EstimateGasInERC20Parameters) => Promise<EstimateGasInERC20ReturnType>;
|
|
20
|
+
//# sourceMappingURL=estimateGasInERC20.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimateGasInERC20.d.ts","sourceRoot":"","sources":["../../../actions/paymaster/estimateGasInERC20.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EAEhB,MAAM,uCAAuC,CAAA;AAE9C,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAExC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAE9E,MAAM,MAAM,4BAA4B,GAAG;IACvC,aAAa,EAAE,aAAa,CAAA;IAC5B,eAAe,EAAE,GAAG,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;CACvB,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,WACnB,sBAAsB,QACxB,4BAA4B,KACnC,QAAQ,4BAA4B,CAyBtC,CAAA"}
|
|
@@ -4,12 +4,14 @@ import type { SponsorUserOperationMiddleware } from "permissionless/actions/smar
|
|
|
4
4
|
import type { Chain, Client, Transport } from "viem";
|
|
5
5
|
import type { SignUserOperationReturnType } from "../../actions/index.js";
|
|
6
6
|
import { signUserOperation } from "../../actions/index.js";
|
|
7
|
+
import { type EstimateGasInERC20Parameters, type EstimateGasInERC20ReturnType } from "../../actions/paymaster/estimateGasInERC20.js";
|
|
7
8
|
import { type SponsorUserOperationParameters, type SponsorUserOperationReturnType } from "../../actions/paymaster/sponsorUserOperation.js";
|
|
8
9
|
export type ZeroDevPaymasterClientActions = {
|
|
9
10
|
/**
|
|
10
11
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
11
12
|
*/
|
|
12
13
|
sponsorUserOperation: (args: SponsorUserOperationParameters) => Promise<SponsorUserOperationReturnType>;
|
|
14
|
+
estimateGasInERC20: (args: EstimateGasInERC20Parameters) => Promise<EstimateGasInERC20ReturnType>;
|
|
13
15
|
};
|
|
14
16
|
export declare const zerodevPaymasterActions: (client: Client) => ZeroDevPaymasterClientActions;
|
|
15
17
|
export type KernelAccountClientActions<TChain extends Chain | undefined = Chain | undefined, TSmartAccount extends SmartAccount | undefined = SmartAccount | undefined> = SmartAccountActions<TChain, TSmartAccount> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../clients/decorators/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAuB,MAAM,gBAAgB,CAAA;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAA;AACzF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,M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AAA;AAaF,MAAM,MAAM,0BAA0B,CAClC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,aAAa,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,IACzE,mBAAmB,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG;IAC7C;;;;;OAKG;IACH,iBAAiB,EAAE,CAAC,UAAU,SAAS,SAAS,EAC5C,IAAI,EAAE,UAAU,CACZ,OAAO,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,CAAC,CAC9D,CAAC,CAAC,CAAC,KACH,OAAO,CAAC,2BAA2B,CAAC,CAAA;CAC5C,CAAA;AAED,eAAO,MAAM,0BAA0B,6BACR,8BAA8B,4QAgBvD,CAAA"}
|
package/_types/types/kernel.d.ts
CHANGED
|
@@ -35,6 +35,21 @@ export type ZeroDevPaymasterRpcSchema = [
|
|
|
35
35
|
}
|
|
36
36
|
];
|
|
37
37
|
ReturnType: Address[];
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
Method: "stackup_getERC20TokenQuotes";
|
|
41
|
+
Parameters: [
|
|
42
|
+
{
|
|
43
|
+
chainId: number;
|
|
44
|
+
userOp: UserOperationWithBigIntAsHex;
|
|
45
|
+
entryPointAddress: Address;
|
|
46
|
+
tokenAddress: Address;
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
ReturnType: {
|
|
50
|
+
maxGasCostToken: string;
|
|
51
|
+
tokenDecimals: string;
|
|
52
|
+
};
|
|
38
53
|
}
|
|
39
54
|
];
|
|
40
55
|
export type KernelValidator<Name extends string = string> = LocalAccount<Name> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../types/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EACb,4BAA4B,EAC/B,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,KAAK,OAAO,EAAE,K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EAAE,CAAA"}
|
package/actions/index.ts
CHANGED
|
@@ -9,3 +9,9 @@ export {
|
|
|
9
9
|
type SignUserOperationParameters,
|
|
10
10
|
type SignUserOperationReturnType
|
|
11
11
|
} from "./account-client/signUserOperation.js"
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
estimateGasInERC20,
|
|
15
|
+
type EstimateGasInERC20Parameters,
|
|
16
|
+
type EstimateGasInERC20ReturnType
|
|
17
|
+
} from "./paymaster/estimateGasInERC20.js"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UserOperation,
|
|
3
|
+
UserOperationWithBigIntAsHex
|
|
4
|
+
} from "permissionless/types/userOperation.js"
|
|
5
|
+
import { deepHexlify } from "permissionless/utils"
|
|
6
|
+
import type { Address, Hex } from "viem"
|
|
7
|
+
import { KERNEL_ADDRESSES } from "../../accounts/index.js"
|
|
8
|
+
import type { ZeroDevPaymasterClient } from "../../clients/paymasterClient.js"
|
|
9
|
+
|
|
10
|
+
export type EstimateGasInERC20Parameters = {
|
|
11
|
+
userOperation: UserOperation
|
|
12
|
+
gasTokenAddress: Hex
|
|
13
|
+
entryPoint?: Address
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type GetERC20TokenQuotesReturnType = {
|
|
17
|
+
maxGasCostToken: string
|
|
18
|
+
tokenDecimals: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type EstimateGasInERC20ReturnType = {
|
|
22
|
+
amount: number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export const estimateGasInERC20 = async (
|
|
30
|
+
client: ZeroDevPaymasterClient,
|
|
31
|
+
args: EstimateGasInERC20Parameters
|
|
32
|
+
): Promise<EstimateGasInERC20ReturnType> => {
|
|
33
|
+
const response = await client.request({
|
|
34
|
+
method: "stackup_getERC20TokenQuotes",
|
|
35
|
+
params: [
|
|
36
|
+
{
|
|
37
|
+
chainId: client.chain?.id as number,
|
|
38
|
+
userOp: deepHexlify(
|
|
39
|
+
args.userOperation
|
|
40
|
+
) as UserOperationWithBigIntAsHex,
|
|
41
|
+
tokenAddress: args.gasTokenAddress,
|
|
42
|
+
entryPointAddress:
|
|
43
|
+
args.entryPoint ?? KERNEL_ADDRESSES.ENTRYPOINT_V0_6
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const result: GetERC20TokenQuotesReturnType = {
|
|
49
|
+
maxGasCostToken: response.maxGasCostToken,
|
|
50
|
+
tokenDecimals: response.tokenDecimals
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const amount =
|
|
54
|
+
Number(result.maxGasCostToken) / 10 ** Number(result.tokenDecimals)
|
|
55
|
+
|
|
56
|
+
return { amount }
|
|
57
|
+
}
|
|
@@ -7,6 +7,11 @@ import type {
|
|
|
7
7
|
SignUserOperationReturnType
|
|
8
8
|
} from "../../actions/index.js"
|
|
9
9
|
import { signUserOperation } from "../../actions/index.js"
|
|
10
|
+
import {
|
|
11
|
+
type EstimateGasInERC20Parameters,
|
|
12
|
+
type EstimateGasInERC20ReturnType,
|
|
13
|
+
estimateGasInERC20
|
|
14
|
+
} from "../../actions/paymaster/estimateGasInERC20.js"
|
|
10
15
|
import {
|
|
11
16
|
type SponsorUserOperationParameters,
|
|
12
17
|
type SponsorUserOperationReturnType,
|
|
@@ -21,13 +26,18 @@ export type ZeroDevPaymasterClientActions = {
|
|
|
21
26
|
sponsorUserOperation: (
|
|
22
27
|
args: SponsorUserOperationParameters
|
|
23
28
|
) => Promise<SponsorUserOperationReturnType>
|
|
29
|
+
estimateGasInERC20: (
|
|
30
|
+
args: EstimateGasInERC20Parameters
|
|
31
|
+
) => Promise<EstimateGasInERC20ReturnType>
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
export const zerodevPaymasterActions = (
|
|
27
35
|
client: Client
|
|
28
36
|
): ZeroDevPaymasterClientActions => ({
|
|
29
37
|
sponsorUserOperation: async (args: SponsorUserOperationParameters) =>
|
|
30
|
-
sponsorUserOperation(client as ZeroDevPaymasterClient, args)
|
|
38
|
+
sponsorUserOperation(client as ZeroDevPaymasterClient, args),
|
|
39
|
+
estimateGasInERC20: async (args: EstimateGasInERC20Parameters) =>
|
|
40
|
+
estimateGasInERC20(client as ZeroDevPaymasterClient, args)
|
|
31
41
|
})
|
|
32
42
|
|
|
33
43
|
// export type KernelAccountClientActions<
|
package/package.json
CHANGED
package/types/kernel.ts
CHANGED
|
@@ -44,6 +44,21 @@ export type ZeroDevPaymasterRpcSchema = [
|
|
|
44
44
|
}
|
|
45
45
|
]
|
|
46
46
|
ReturnType: Address[]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
Method: "stackup_getERC20TokenQuotes"
|
|
50
|
+
Parameters: [
|
|
51
|
+
{
|
|
52
|
+
chainId: number
|
|
53
|
+
userOp: UserOperationWithBigIntAsHex
|
|
54
|
+
entryPointAddress: Address
|
|
55
|
+
tokenAddress: Address
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
ReturnType: {
|
|
59
|
+
maxGasCostToken: string
|
|
60
|
+
tokenDecimals: string
|
|
61
|
+
}
|
|
47
62
|
}
|
|
48
63
|
]
|
|
49
64
|
|