abstractionkit 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright <2023> <CandideLabs>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ <!-- PROJECT LOGO -->
2
+
3
+ <div align="center">
4
+ <h1 align="center">AbstractionKit - Account Abstraction SDK by Candide</h2>
5
+ </div>
6
+
7
+ <div align="center">
8
+ <img src="https://user-images.githubusercontent.com/7014833/203773780-04a0c8c0-93a6-43a4-bb75-570cb951dfa0.png" height =200>
9
+ </div>
10
+
11
+ # About
12
+
13
+ AbstractionKit - Account Abstraction SDK by Candide
14
+
15
+ <!-- LICENSE -->
16
+ ## License
17
+
18
+ MIT
@@ -0,0 +1,21 @@
1
+ import type { UserOperation, JsonRpcError, GasEstimationResult, UserOperationByHashResult, UserOperationReceiptResult, AbiInputValue, JsonRpcResponse } from "./types";
2
+ import { BytesLike } from "ethers";
3
+ export declare class Bundler {
4
+ readonly rpcUrl: string;
5
+ readonly entrypointAddress: string;
6
+ constructor(rpcUrl: string, entrypointAddress: string);
7
+ chainId(): Promise<{
8
+ chainId: string;
9
+ } | JsonRpcError>;
10
+ supportedEntryPoints(): Promise<{
11
+ supportedEntryPoints: string[];
12
+ } | JsonRpcError>;
13
+ estimateUserOperationGas(useroperation: UserOperation): Promise<GasEstimationResult | JsonRpcError>;
14
+ sendUserOperation(useroperation: UserOperation): Promise<{
15
+ userOperationHash: string;
16
+ } | JsonRpcError>;
17
+ getUserOperationReceipt(useroperationhash: BytesLike): Promise<UserOperationReceiptResult | JsonRpcError>;
18
+ getUserOperationByHash(useroperationhash: BytesLike): Promise<UserOperationByHashResult | JsonRpcError>;
19
+ sendJsonRpcRequest(rpcUrl: string, method: string, params: AbiInputValue): Promise<JsonRpcResponse>;
20
+ }
21
+ //# sourceMappingURL=Bundler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Bundler.d.ts","sourceRoot":"","sources":["../src/Bundler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EAEzB,0BAA0B,EAC1B,aAAa,EACb,eAAe,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,qBAAa,OAAO;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;gBAEvB,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM;IAK/C,OAAO,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,YAAY,CAAC;IAatD,oBAAoB,IAAI,OAAO,CACpC;QAAE,oBAAoB,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,YAAY,CACjD;IAcK,wBAAwB,CAC7B,aAAa,EAAE,aAAa,GAC1B,OAAO,CAAC,mBAAmB,GAAG,YAAY,CAAC;IAcxC,iBAAiB,CACtB,aAAa,EAAE,aAAa,GAC1B,OAAO,CAAC;QAAE,iBAAiB,EAAE,MAAM,CAAA;KAAE,GAAG,YAAY,CAAC;IAclD,uBAAuB,CAC5B,iBAAiB,EAAE,SAAS,GAC1B,OAAO,CAAC,0BAA0B,GAAG,YAAY,CAAC;IAyB/C,sBAAsB,CAC3B,iBAAiB,EAAE,SAAS,GAC1B,OAAO,CAAC,yBAAyB,GAAG,YAAY,CAAC;IAc9C,kBAAkB,CACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,GACnB,OAAO,CAAC,eAAe,CAAC;CAuB3B"}
@@ -0,0 +1,9 @@
1
+ export { SmartAccount } from "./account/SmartAccount";
2
+ export { CandideAccount } from "./account/CandideAccount";
3
+ export { SmartAccountFactory } from "./factory/SmartAccountFactory";
4
+ export { CandideAccountFactory } from "./factory/CandideAccountFactory";
5
+ export { Bundler } from "./Bundler";
6
+ export { getUserOperationHash } from "./utils";
7
+ export { UserOperationEmptyValues } from "./constants";
8
+ export type { UserOperation, AbiInputValue, JsonRpcResponse, JsonRpcResult, JsonRpcError, GasEstimationResult, UserOperationByHashResult, UserOperationReceipt, UserOperationReceiptResult, } from "./types";
9
+ //# sourceMappingURL=abstractionkit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstractionkit.d.ts","sourceRoot":"","sources":["../src/abstractionkit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,YAAY,EACX,aAAa,EACb,aAAa,EACb,eAAe,EACf,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,GAC1B,MAAM,SAAS,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { SmartAccount } from "./SmartAccount";
2
+ import type { BigNumberish, BytesLike } from "ethers";
3
+ import type { Operation } from "../types";
4
+ import { SmartAccountFactory } from "../factory/SmartAccountFactory";
5
+ export declare class CandideAccount extends SmartAccount {
6
+ readonly entrypointAddress: string;
7
+ readonly candideAccountFactory: SmartAccountFactory;
8
+ constructor(singletonAddress?: string, entrypointAddress?: string, candideAccountFactory?: SmartAccountFactory);
9
+ createNewAccount(owners: string[], threshold?: BigNumberish): [string, BytesLike];
10
+ createNewAccount(owners: string[], threshold: BigNumberish, c2nonce: BigNumberish): [string, BytesLike];
11
+ createNewAccount(owners: string[], threshold: BigNumberish, c2nonce: BigNumberish, fallbackHandler: string): [string, BytesLike];
12
+ createSendEthCallData(to: string, value: BigNumberish): BytesLike;
13
+ createCallData(to: string, value: BigNumberish, data: BytesLike, operation: Operation, paymaster: string, approveToken: string, approveAmount: BigNumberish): BytesLike;
14
+ }
15
+ //# sourceMappingURL=CandideAccount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CandideAccount.d.ts","sourceRoot":"","sources":["../../src/account/CandideAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,qBAAa,cAAe,SAAQ,YAAY;IAC/C,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;gBAGnD,gBAAgB,GAAE,MAAqD,EACvE,iBAAiB,GAAE,MAAqD,EACxE,qBAAqB,GAAE,mBAAiD;IAuCzE,gBAAgB,CACf,MAAM,EAAE,MAAM,EAAE,EAChB,SAAS,CAAC,EAAE,YAAY,GACtB,CAAC,MAAM,EAAE,SAAS,CAAC;IACtB,gBAAgB,CACf,MAAM,EAAE,MAAM,EAAE,EAChB,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,YAAY,GACnB,CAAC,MAAM,EAAE,SAAS,CAAC;IACtB,gBAAgB,CACf,MAAM,EAAE,MAAM,EAAE,EAChB,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,MAAM,GACrB,CAAC,MAAM,EAAE,SAAS,CAAC;IA2CtB,qBAAqB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,SAAS;IAGjE,cAAc,CACb,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,YAAY,GACzB,SAAS;CAYZ"}
@@ -0,0 +1,15 @@
1
+ import type { BytesLike, BigNumberish } from "ethers";
2
+ import { AbiInputValue } from "../types";
3
+ export declare class SmartAccount {
4
+ readonly singletonAddress: string;
5
+ readonly proxyByteCode: BytesLike;
6
+ readonly initializerFunctionSelector: string;
7
+ readonly initializerFunctionInputAbi: string[];
8
+ readonly executorFunctionSelector: string;
9
+ readonly executorFunctionInputAbi: string[];
10
+ constructor(singletonAddress: string, proxyByteCode: BytesLike, initializerFunctionSelector: string, initializerFunctionInputAbi: string[], executorFunctionSelector: string, executorFunctionInputAbi: string[]);
11
+ getInitializerCallData(initializerFunctionInputParameters: AbiInputValue[]): BytesLike;
12
+ getExecutorCallData(executorFunctionInputParameters: AbiInputValue[]): BytesLike;
13
+ getProxyAddress(initializerCallData: BytesLike, factoryAddress: string, c2Nonce: BigNumberish): string;
14
+ }
15
+ //# sourceMappingURL=SmartAccount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmartAccount.d.ts","sourceRoot":"","sources":["../../src/account/SmartAccount.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,qBAAa,YAAY;IACxB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAClC,QAAQ,CAAC,2BAA2B,EAAE,MAAM,CAAC;IAC7C,QAAQ,CAAC,2BAA2B,EAAE,MAAM,EAAE,CAAC;IAC/C,QAAQ,CAAC,wBAAwB,EAAE,MAAM,CAAC;IAC1C,QAAQ,CAAC,wBAAwB,EAAE,MAAM,EAAE,CAAC;gBAG3C,gBAAgB,EAAE,MAAM,EACxB,aAAa,EAAE,SAAS,EACxB,2BAA2B,EAAE,MAAM,EACnC,2BAA2B,EAAE,MAAM,EAAE,EACrC,wBAAwB,EAAE,MAAM,EAChC,wBAAwB,EAAE,MAAM,EAAE;IAUnC,sBAAsB,CACrB,kCAAkC,EAAE,aAAa,EAAE,GACjD,SAAS;IASZ,mBAAmB,CAClB,+BAA+B,EAAE,aAAa,EAAE,GAC9C,SAAS;IASZ,eAAe,CACd,mBAAmB,EAAE,SAAS,EAC9B,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,YAAY,GACnB,MAAM;CAqBT"}
@@ -0,0 +1,3 @@
1
+ import type { UserOperation } from "./types";
2
+ export declare const UserOperationEmptyValues: UserOperation;
3
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,wBAAwB,EAAE,aAYtC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { SmartAccountFactory } from "./SmartAccountFactory";
2
+ export declare class CandideAccountFactory extends SmartAccountFactory {
3
+ constructor(address?: string);
4
+ }
5
+ //# sourceMappingURL=CandideAccountFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CandideAccountFactory.d.ts","sourceRoot":"","sources":["../../src/factory/CandideAccountFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,qBAAa,qBAAsB,SAAQ,mBAAmB;gBACjD,OAAO,GAAE,MAAqD;CAK1E"}
@@ -0,0 +1,10 @@
1
+ import type { BytesLike } from "ethers";
2
+ import type { AbiInputValue } from "../types";
3
+ export declare class SmartAccountFactory {
4
+ readonly address: string;
5
+ readonly generatorFunctionSelector: string;
6
+ readonly generatorFunctionInputAbi: string[];
7
+ constructor(address: string, generatorFunctionSelector: string, generatorFunctionInputAbi: string[]);
8
+ getFactoryGeneratorFunctionCallData(generatorFunctionInputParameters: AbiInputValue[]): BytesLike;
9
+ }
10
+ //# sourceMappingURL=SmartAccountFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmartAccountFactory.d.ts","sourceRoot":"","sources":["../../src/factory/SmartAccountFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,qBAAa,mBAAmB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,yBAAyB,EAAE,MAAM,CAAC;IAC3C,QAAQ,CAAC,yBAAyB,EAAE,MAAM,EAAE,CAAC;gBAG5C,OAAO,EAAE,MAAM,EACf,yBAAyB,EAAE,MAAM,EACjC,yBAAyB,EAAE,MAAM,EAAE;IAOpC,mCAAmC,CAClC,gCAAgC,EAAE,aAAa,EAAE,GAC/C,SAAS;CAUZ"}
@@ -0,0 +1,4 @@
1
+ import * as abstractionkit from "./abstractionkit.js";
2
+ export { abstractionkit };
3
+ export * from "./abstractionkit.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,cAAc,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ var e=require("ethers");function t(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,t}var r=/*#__PURE__*/t(require("isomorphic-unfetch"));function n(t,r,n){var i=e.keccak256(function(t){var r=[t.sender,t.nonce,e.keccak256(t.initCode),e.keccak256(t.callData),t.callGasLimit,t.verificationGasLimit,t.preVerificationGas,t.maxFeePerGas,t.maxPriorityFeePerGas,e.keccak256(t.paymasterAndData)];return e.AbiCoder.defaultAbiCoder().encode(["address","uint256","bytes32","bytes32","uint256","uint256","uint256","uint256","uint256","bytes32"],r)}(t)),o=e.AbiCoder.defaultAbiCoder().encode(["bytes32","address","uint256"],[i,r,n]);return e.keccak256(o)}function i(t,r,n){return t+e.AbiCoder.defaultAbiCoder().encode(r,n).slice(2)}var o=/*#__PURE__*/function(){function t(e,t,r,n,i,o){this.singletonAddress=void 0,this.proxyByteCode=void 0,this.initializerFunctionSelector=void 0,this.initializerFunctionInputAbi=void 0,this.executorFunctionSelector=void 0,this.executorFunctionInputAbi=void 0,this.singletonAddress=e,this.proxyByteCode=t,this.initializerFunctionSelector=r,this.initializerFunctionInputAbi=n,this.executorFunctionSelector=i,this.executorFunctionInputAbi=o}var r=t.prototype;return r.getInitializerCallData=function(e){return i(this.initializerFunctionSelector,this.initializerFunctionInputAbi,e)},r.getExecutorCallData=function(e){return i(this.executorFunctionSelector,this.executorFunctionInputAbi,e)},r.getProxyAddress=function(t,r,n){var i=e.keccak256(e.solidityPacked(["bytes32","uint256"],[e.keccak256(t),n])),o=e.keccak256(e.solidityPacked(["bytes","uint256"],[this.proxyByteCode,this.singletonAddress]));return"0x"+e.solidityPackedKeccak256(["bytes1","address","bytes32","bytes32"],["0xff",r,i,o]).slice(-40)},t}();function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s.apply(this,arguments)}function c(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,a(e,t)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}var u=/*#__PURE__*/function(){function e(e,t,r){this.address=void 0,this.generatorFunctionSelector=void 0,this.generatorFunctionInputAbi=void 0,this.address=e,this.generatorFunctionSelector=t,this.generatorFunctionInputAbi=r}return e.prototype.getFactoryGeneratorFunctionCallData=function(e){var t=i(this.generatorFunctionSelector,this.generatorFunctionInputAbi,e);return this.address+t.slice(2)},e}(),d=/*#__PURE__*/function(e){function t(t){return void 0===t&&(t="0xb73Eb505Abc30d0e7e15B73A492863235B3F4309"),e.call(this,t,"0x1688f0b9",["address","bytes","uint256"])||this}return c(t,e),t}(u),l=/*#__PURE__*/function(t){function r(e,r,n){var i;return void 0===e&&(e="0x3A0a17Bcc84576b099373ab3Eed9702b07D30402"),void 0===r&&(r="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"),void 0===n&&(n=new d),(i=t.call(this,e,"0x608060405234801561001057600080fd5b5060405161017338038061017383398101604081905261002f916100b9565b6001600160a01b0381166100945760405162461bcd60e51b815260206004820152602260248201527f496e76616c69642073696e676c65746f6e20616464726573732070726f766964604482015261195960f21b606482015260840160405180910390fd5b600080546001600160a01b0319166001600160a01b03929092169190911790556100e9565b6000602082840312156100cb57600080fd5b81516001600160a01b03811681146100e257600080fd5b9392505050565b607c806100f76000396000f3fe6080604052600080546001600160a01b0316813563530ca43760e11b1415602857808252602082f35b3682833781823684845af490503d82833e806041573d82fd5b503d81f3fea2646970667358221220022b6bb97dd1e16cb867add83d4159f7550336cbb5b40514145e43f493c1377664736f6c634300080c0033","0x6a1e9826",["address[]","uint256","address","bytes","address","address","uint256","address","address"],"0xf34308ef",["address","uint256","bytes","uint8","address","address","uint256"])||this).entrypointAddress=void 0,i.candideAccountFactory=void 0,i.entrypointAddress=r,i.candideAccountFactory=n,i}c(r,t);var n=r.prototype;return n.createNewAccount=function(t,r,n,i){void 0===r&&(r=1),void 0===n&&(n=0),void 0===i&&(i=e.ZeroAddress);var o=this.getInitializerCallData([t,r,e.ZeroAddress,"0x",i,e.ZeroAddress,0,e.ZeroAddress,this.entrypointAddress]);return[this.getProxyAddress(o,this.candideAccountFactory.address,n),this.candideAccountFactory.getFactoryGeneratorFunctionCallData([this.singletonAddress,o,n])]},n.createSendEthCallData=function(t,r){return this.createCallData(t,r,"0x",0,e.ZeroAddress,e.ZeroAddress,0)},n.createCallData=function(e,t,r,n,i,o,s){return this.getExecutorCallData([e,t,r,n,i,o,s])},r}(o),p=/*#__PURE__*/function(){function e(e,t){this.rpcUrl=void 0,this.entrypointAddress=void 0,this.rpcUrl=e,this.entrypointAddress=t}var t=e.prototype;return t.chainId=function(){try{return Promise.resolve(this.sendJsonRpcRequest(this.rpcUrl,"eth_chainId",[])).then(function(e){return"result"in e?{chainId:e.result}:e.error})}catch(e){return Promise.reject(e)}},t.supportedEntryPoints=function(){try{return Promise.resolve(this.sendJsonRpcRequest(this.rpcUrl,"eth_supportedEntryPoints",[])).then(function(e){return"result"in e?{supportedEntryPoints:e.result}:e.error})}catch(e){return Promise.reject(e)}},t.estimateUserOperationGas=function(e){try{var t=this;return Promise.resolve(t.sendJsonRpcRequest(t.rpcUrl,"eth_estimateUserOperationGas",[e,t.entrypointAddress])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},t.sendUserOperation=function(e){try{var t=this;return Promise.resolve(t.sendJsonRpcRequest(t.rpcUrl,"eth_sendUserOperation",[e,t.entrypointAddress])).then(function(e){return"result"in e?{userOperationHash:e.result}:e.error})}catch(e){return Promise.reject(e)}},t.getUserOperationReceipt=function(e){try{return Promise.resolve(this.sendJsonRpcRequest(this.rpcUrl,"eth_getUserOperationReceipt",[e])).then(function(e){if("result"in e){var t=e.result,r=s({},t.receipt,{logs:JSON.stringify(t.receipt.logs)});return s({},t,{logs:JSON.stringify(t.logs),receipt:r})}return e.error})}catch(e){return Promise.reject(e)}},t.getUserOperationByHash=function(e){try{return Promise.resolve(this.sendJsonRpcRequest(this.rpcUrl,"eth_getUserOperationByHash",[e])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},t.sendJsonRpcRequest=function(e,t,n){try{var i=r.default||r,o=JSON.stringify({method:t,params:n,id:1,jsonrpc:"2.0"});return Promise.resolve(i(e,{method:"POST",headers:{"Content-Type":"application/json"},body:o,redirect:"follow"})).then(function(e){return Promise.resolve(e.text()).then(JSON.parse)})}catch(e){return Promise.reject(e)}},e}(),h={sender:e.ZeroAddress,nonce:0,initCode:"0x",callData:"0x",callGasLimit:0,verificationGasLimit:0,preVerificationGas:0,maxFeePerGas:0,maxPriorityFeePerGas:0,paymasterAndData:"0x",signature:"0x"},f={__proto__:null,SmartAccount:o,CandideAccount:l,SmartAccountFactory:u,CandideAccountFactory:d,Bundler:p,getUserOperationHash:n,UserOperationEmptyValues:h};exports.Bundler=p,exports.CandideAccount=l,exports.CandideAccountFactory=d,exports.SmartAccount=o,exports.SmartAccountFactory=u,exports.UserOperationEmptyValues=h,exports.abstractionkit=f,exports.getUserOperationHash=n;
@@ -0,0 +1 @@
1
+ import{keccak256 as t,AbiCoder as e,solidityPacked as r,solidityPackedKeccak256 as n,ZeroAddress as i}from"ethers";import*as o from"isomorphic-unfetch";function s(r,n,i){var o=t(function(r){var n=[r.sender,r.nonce,t(r.initCode),t(r.callData),r.callGasLimit,r.verificationGasLimit,r.preVerificationGas,r.maxFeePerGas,r.maxPriorityFeePerGas,t(r.paymasterAndData)];return e.defaultAbiCoder().encode(["address","uint256","bytes32","bytes32","uint256","uint256","uint256","uint256","uint256","bytes32"],n)}(r)),s=e.defaultAbiCoder().encode(["bytes32","address","uint256"],[o,n,i]);return t(s)}function c(t,r,n){return t+e.defaultAbiCoder().encode(r,n).slice(2)}var a=/*#__PURE__*/function(){function e(t,e,r,n,i,o){this.singletonAddress=void 0,this.proxyByteCode=void 0,this.initializerFunctionSelector=void 0,this.initializerFunctionInputAbi=void 0,this.executorFunctionSelector=void 0,this.executorFunctionInputAbi=void 0,this.singletonAddress=t,this.proxyByteCode=e,this.initializerFunctionSelector=r,this.initializerFunctionInputAbi=n,this.executorFunctionSelector=i,this.executorFunctionInputAbi=o}var i=e.prototype;return i.getInitializerCallData=function(t){return c(this.initializerFunctionSelector,this.initializerFunctionInputAbi,t)},i.getExecutorCallData=function(t){return c(this.executorFunctionSelector,this.executorFunctionInputAbi,t)},i.getProxyAddress=function(e,i,o){var s=t(r(["bytes32","uint256"],[t(e),o])),c=t(r(["bytes","uint256"],[this.proxyByteCode,this.singletonAddress]));return"0x"+n(["bytes1","address","bytes32","bytes32"],["0xff",i,s,c]).slice(-40)},e}();function u(){return u=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},u.apply(this,arguments)}function d(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,l(t,e)}function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}var p=/*#__PURE__*/function(){function t(t,e,r){this.address=void 0,this.generatorFunctionSelector=void 0,this.generatorFunctionInputAbi=void 0,this.address=t,this.generatorFunctionSelector=e,this.generatorFunctionInputAbi=r}return t.prototype.getFactoryGeneratorFunctionCallData=function(t){var e=c(this.generatorFunctionSelector,this.generatorFunctionInputAbi,t);return this.address+e.slice(2)},t}(),h=/*#__PURE__*/function(t){function e(e){return void 0===e&&(e="0xb73Eb505Abc30d0e7e15B73A492863235B3F4309"),t.call(this,e,"0x1688f0b9",["address","bytes","uint256"])||this}return d(e,t),e}(p),f=/*#__PURE__*/function(t){function e(e,r,n){var i;return void 0===e&&(e="0x3A0a17Bcc84576b099373ab3Eed9702b07D30402"),void 0===r&&(r="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"),void 0===n&&(n=new h),(i=t.call(this,e,"0x608060405234801561001057600080fd5b5060405161017338038061017383398101604081905261002f916100b9565b6001600160a01b0381166100945760405162461bcd60e51b815260206004820152602260248201527f496e76616c69642073696e676c65746f6e20616464726573732070726f766964604482015261195960f21b606482015260840160405180910390fd5b600080546001600160a01b0319166001600160a01b03929092169190911790556100e9565b6000602082840312156100cb57600080fd5b81516001600160a01b03811681146100e257600080fd5b9392505050565b607c806100f76000396000f3fe6080604052600080546001600160a01b0316813563530ca43760e11b1415602857808252602082f35b3682833781823684845af490503d82833e806041573d82fd5b503d81f3fea2646970667358221220022b6bb97dd1e16cb867add83d4159f7550336cbb5b40514145e43f493c1377664736f6c634300080c0033","0x6a1e9826",["address[]","uint256","address","bytes","address","address","uint256","address","address"],"0xf34308ef",["address","uint256","bytes","uint8","address","address","uint256"])||this).entrypointAddress=void 0,i.candideAccountFactory=void 0,i.entrypointAddress=r,i.candideAccountFactory=n,i}d(e,t);var r=e.prototype;return r.createNewAccount=function(t,e,r,n){void 0===e&&(e=1),void 0===r&&(r=0),void 0===n&&(n=i);var o=this.getInitializerCallData([t,e,i,"0x",n,i,0,i,this.entrypointAddress]);return[this.getProxyAddress(o,this.candideAccountFactory.address,r),this.candideAccountFactory.getFactoryGeneratorFunctionCallData([this.singletonAddress,o,r])]},r.createSendEthCallData=function(t,e){return this.createCallData(t,e,"0x",0,i,i,0)},r.createCallData=function(t,e,r,n,i,o,s){return this.getExecutorCallData([t,e,r,n,i,o,s])},e}(a),y=/*#__PURE__*/function(){function t(t,e){this.rpcUrl=void 0,this.entrypointAddress=void 0,this.rpcUrl=t,this.entrypointAddress=e}var e=t.prototype;return e.chainId=function(){try{return Promise.resolve(this.sendJsonRpcRequest(this.rpcUrl,"eth_chainId",[])).then(function(t){return"result"in t?{chainId:t.result}:t.error})}catch(t){return Promise.reject(t)}},e.supportedEntryPoints=function(){try{return Promise.resolve(this.sendJsonRpcRequest(this.rpcUrl,"eth_supportedEntryPoints",[])).then(function(t){return"result"in t?{supportedEntryPoints:t.result}:t.error})}catch(t){return Promise.reject(t)}},e.estimateUserOperationGas=function(t){try{var e=this;return Promise.resolve(e.sendJsonRpcRequest(e.rpcUrl,"eth_estimateUserOperationGas",[t,e.entrypointAddress])).then(function(t){return"result"in t?t.result:t.error})}catch(t){return Promise.reject(t)}},e.sendUserOperation=function(t){try{var e=this;return Promise.resolve(e.sendJsonRpcRequest(e.rpcUrl,"eth_sendUserOperation",[t,e.entrypointAddress])).then(function(t){return"result"in t?{userOperationHash:t.result}:t.error})}catch(t){return Promise.reject(t)}},e.getUserOperationReceipt=function(t){try{return Promise.resolve(this.sendJsonRpcRequest(this.rpcUrl,"eth_getUserOperationReceipt",[t])).then(function(t){if("result"in t){var e=t.result,r=u({},e.receipt,{logs:JSON.stringify(e.receipt.logs)});return u({},e,{logs:JSON.stringify(e.logs),receipt:r})}return t.error})}catch(t){return Promise.reject(t)}},e.getUserOperationByHash=function(t){try{return Promise.resolve(this.sendJsonRpcRequest(this.rpcUrl,"eth_getUserOperationByHash",[t])).then(function(t){return"result"in t?t.result:t.error})}catch(t){return Promise.reject(t)}},e.sendJsonRpcRequest=function(t,e,r){try{var n=o.default||o,i=JSON.stringify({method:e,params:r,id:1,jsonrpc:"2.0"});return Promise.resolve(n(t,{method:"POST",headers:{"Content-Type":"application/json"},body:i,redirect:"follow"})).then(function(t){return Promise.resolve(t.text()).then(JSON.parse)})}catch(t){return Promise.reject(t)}},t}(),b={sender:i,nonce:0,initCode:"0x",callData:"0x",callGasLimit:0,verificationGasLimit:0,preVerificationGas:0,maxFeePerGas:0,maxPriorityFeePerGas:0,paymasterAndData:"0x",signature:"0x"},v={__proto__:null,SmartAccount:a,CandideAccount:f,SmartAccountFactory:p,CandideAccountFactory:h,Bundler:y,getUserOperationHash:s,UserOperationEmptyValues:b};export{y as Bundler,f as CandideAccount,h as CandideAccountFactory,a as SmartAccount,p as SmartAccountFactory,b as UserOperationEmptyValues,v as abstractionkit,s as getUserOperationHash};
@@ -0,0 +1 @@
1
+ import{keccak256 as t,AbiCoder as e,solidityPacked as r,solidityPackedKeccak256 as s,ZeroAddress as i}from"ethers";import*as n from"isomorphic-unfetch";function a(r,s,i){const n=t(function(r){const s=[r.sender,r.nonce,t(r.initCode),t(r.callData),r.callGasLimit,r.verificationGasLimit,r.preVerificationGas,r.maxFeePerGas,r.maxPriorityFeePerGas,t(r.paymasterAndData)];return e.defaultAbiCoder().encode(["address","uint256","bytes32","bytes32","uint256","uint256","uint256","uint256","uint256","bytes32"],s)}(r)),a=e.defaultAbiCoder().encode(["bytes32","address","uint256"],[n,s,i]);return t(a)}function o(t,r,s){return t+e.defaultAbiCoder().encode(r,s).slice(2)}class c{constructor(t,e,r,s,i,n){this.singletonAddress=void 0,this.proxyByteCode=void 0,this.initializerFunctionSelector=void 0,this.initializerFunctionInputAbi=void 0,this.executorFunctionSelector=void 0,this.executorFunctionInputAbi=void 0,this.singletonAddress=t,this.proxyByteCode=e,this.initializerFunctionSelector=r,this.initializerFunctionInputAbi=s,this.executorFunctionSelector=i,this.executorFunctionInputAbi=n}getInitializerCallData(t){return o(this.initializerFunctionSelector,this.initializerFunctionInputAbi,t)}getExecutorCallData(t){return o(this.executorFunctionSelector,this.executorFunctionInputAbi,t)}getProxyAddress(e,i,n){const a=t(r(["bytes32","uint256"],[t(e),n])),o=t(r(["bytes","uint256"],[this.proxyByteCode,this.singletonAddress]));return"0x"+s(["bytes1","address","bytes32","bytes32"],["0xff",i,a,o]).slice(-40)}}class d{constructor(t,e,r){this.address=void 0,this.generatorFunctionSelector=void 0,this.generatorFunctionInputAbi=void 0,this.address=t,this.generatorFunctionSelector=e,this.generatorFunctionInputAbi=r}getFactoryGeneratorFunctionCallData(t){const e=o(this.generatorFunctionSelector,this.generatorFunctionInputAbi,t);return this.address+e.slice(2)}}class u extends d{constructor(t="0xb73Eb505Abc30d0e7e15B73A492863235B3F4309"){super(t,"0x1688f0b9",["address","bytes","uint256"])}}class l extends c{constructor(t="0x3A0a17Bcc84576b099373ab3Eed9702b07D30402",e="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",r=new u){super(t,"0x608060405234801561001057600080fd5b5060405161017338038061017383398101604081905261002f916100b9565b6001600160a01b0381166100945760405162461bcd60e51b815260206004820152602260248201527f496e76616c69642073696e676c65746f6e20616464726573732070726f766964604482015261195960f21b606482015260840160405180910390fd5b600080546001600160a01b0319166001600160a01b03929092169190911790556100e9565b6000602082840312156100cb57600080fd5b81516001600160a01b03811681146100e257600080fd5b9392505050565b607c806100f76000396000f3fe6080604052600080546001600160a01b0316813563530ca43760e11b1415602857808252602082f35b3682833781823684845af490503d82833e806041573d82fd5b503d81f3fea2646970667358221220022b6bb97dd1e16cb867add83d4159f7550336cbb5b40514145e43f493c1377664736f6c634300080c0033","0x6a1e9826",["address[]","uint256","address","bytes","address","address","uint256","address","address"],"0xf34308ef",["address","uint256","bytes","uint8","address","address","uint256"]),this.entrypointAddress=void 0,this.candideAccountFactory=void 0,this.entrypointAddress=e,this.candideAccountFactory=r}createNewAccount(t,e=1,r=0,s=i){const n=this.getInitializerCallData([t,e,i,"0x",s,i,0,i,this.entrypointAddress]);return[this.getProxyAddress(n,this.candideAccountFactory.address,r),this.candideAccountFactory.getFactoryGeneratorFunctionCallData([this.singletonAddress,n,r])]}createSendEthCallData(t,e){return this.createCallData(t,e,"0x",0,i,i,0)}createCallData(t,e,r,s,i,n,a){return this.getExecutorCallData([t,e,r,s,i,n,a])}}function h(){return h=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},h.apply(this,arguments)}class p{constructor(t,e){this.rpcUrl=void 0,this.entrypointAddress=void 0,this.rpcUrl=t,this.entrypointAddress=e}async chainId(){const t=await this.sendJsonRpcRequest(this.rpcUrl,"eth_chainId",[]);return"result"in t?{chainId:t.result}:t.error}async supportedEntryPoints(){const t=await this.sendJsonRpcRequest(this.rpcUrl,"eth_supportedEntryPoints",[]);return"result"in t?{supportedEntryPoints:t.result}:t.error}async estimateUserOperationGas(t){const e=await this.sendJsonRpcRequest(this.rpcUrl,"eth_estimateUserOperationGas",[t,this.entrypointAddress]);return"result"in e?e.result:e.error}async sendUserOperation(t){const e=await this.sendJsonRpcRequest(this.rpcUrl,"eth_sendUserOperation",[t,this.entrypointAddress]);return"result"in e?{userOperationHash:e.result}:e.error}async getUserOperationReceipt(t){const e=await this.sendJsonRpcRequest(this.rpcUrl,"eth_getUserOperationReceipt",[t]);if("result"in e){const t=e.result,r=h({},t.receipt,{logs:JSON.stringify(t.receipt.logs)});return h({},t,{logs:JSON.stringify(t.logs),receipt:r})}return e.error}async getUserOperationByHash(t){const e=await this.sendJsonRpcRequest(this.rpcUrl,"eth_getUserOperationByHash",[t]);return"result"in e?e.result:e.error}async sendJsonRpcRequest(t,e,r){const s=n.default||n,i={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:e,params:r,id:1,jsonrpc:"2.0"}),redirect:"follow"},a=await s(t,i);return JSON.parse(await a.text())}}const b={sender:i,nonce:0,initCode:"0x",callData:"0x",callGasLimit:0,verificationGasLimit:0,preVerificationGas:0,maxFeePerGas:0,maxPriorityFeePerGas:0,paymasterAndData:"0x",signature:"0x"};var y={__proto__:null,SmartAccount:c,CandideAccount:l,SmartAccountFactory:d,CandideAccountFactory:u,Bundler:p,getUserOperationHash:a,UserOperationEmptyValues:b};export{p as Bundler,l as CandideAccount,u as CandideAccountFactory,c as SmartAccount,d as SmartAccountFactory,b as UserOperationEmptyValues,y as abstractionkit,a as getUserOperationHash};
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("ethers"),require("isomorphic-unfetch")):"function"==typeof define&&define.amd?define(["exports","ethers","isomorphic-unfetch"],t):t((e||self).abstractionkit={},e.ethers,e.isomorphicUnfetch)}(this,function(e,t,r){function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,t}var i=/*#__PURE__*/n(r);function o(e,r,n){var i=t.keccak256(function(e){var r=[e.sender,e.nonce,t.keccak256(e.initCode),t.keccak256(e.callData),e.callGasLimit,e.verificationGasLimit,e.preVerificationGas,e.maxFeePerGas,e.maxPriorityFeePerGas,t.keccak256(e.paymasterAndData)];return t.AbiCoder.defaultAbiCoder().encode(["address","uint256","bytes32","bytes32","uint256","uint256","uint256","uint256","uint256","bytes32"],r)}(e)),o=t.AbiCoder.defaultAbiCoder().encode(["bytes32","address","uint256"],[i,r,n]);return t.keccak256(o)}function s(e,r,n){return e+t.AbiCoder.defaultAbiCoder().encode(r,n).slice(2)}var c=/*#__PURE__*/function(){function e(e,t,r,n,i,o){this.singletonAddress=void 0,this.proxyByteCode=void 0,this.initializerFunctionSelector=void 0,this.initializerFunctionInputAbi=void 0,this.executorFunctionSelector=void 0,this.executorFunctionInputAbi=void 0,this.singletonAddress=e,this.proxyByteCode=t,this.initializerFunctionSelector=r,this.initializerFunctionInputAbi=n,this.executorFunctionSelector=i,this.executorFunctionInputAbi=o}var r=e.prototype;return r.getInitializerCallData=function(e){return s(this.initializerFunctionSelector,this.initializerFunctionInputAbi,e)},r.getExecutorCallData=function(e){return s(this.executorFunctionSelector,this.executorFunctionInputAbi,e)},r.getProxyAddress=function(e,r,n){var i=t.keccak256(t.solidityPacked(["bytes32","uint256"],[t.keccak256(e),n])),o=t.keccak256(t.solidityPacked(["bytes","uint256"],[this.proxyByteCode,this.singletonAddress]));return"0x"+t.solidityPackedKeccak256(["bytes1","address","bytes32","bytes32"],["0xff",r,i,o]).slice(-40)},e}();function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}function u(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,d(e,t)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var l=/*#__PURE__*/function(){function e(e,t,r){this.address=void 0,this.generatorFunctionSelector=void 0,this.generatorFunctionInputAbi=void 0,this.address=e,this.generatorFunctionSelector=t,this.generatorFunctionInputAbi=r}return e.prototype.getFactoryGeneratorFunctionCallData=function(e){var t=s(this.generatorFunctionSelector,this.generatorFunctionInputAbi,e);return this.address+t.slice(2)},e}(),f=/*#__PURE__*/function(e){function t(t){return void 0===t&&(t="0xb73Eb505Abc30d0e7e15B73A492863235B3F4309"),e.call(this,t,"0x1688f0b9",["address","bytes","uint256"])||this}return u(t,e),t}(l),p=/*#__PURE__*/function(e){function r(t,r,n){var i;return void 0===t&&(t="0x3A0a17Bcc84576b099373ab3Eed9702b07D30402"),void 0===r&&(r="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"),void 0===n&&(n=new f),(i=e.call(this,t,"0x608060405234801561001057600080fd5b5060405161017338038061017383398101604081905261002f916100b9565b6001600160a01b0381166100945760405162461bcd60e51b815260206004820152602260248201527f496e76616c69642073696e676c65746f6e20616464726573732070726f766964604482015261195960f21b606482015260840160405180910390fd5b600080546001600160a01b0319166001600160a01b03929092169190911790556100e9565b6000602082840312156100cb57600080fd5b81516001600160a01b03811681146100e257600080fd5b9392505050565b607c806100f76000396000f3fe6080604052600080546001600160a01b0316813563530ca43760e11b1415602857808252602082f35b3682833781823684845af490503d82833e806041573d82fd5b503d81f3fea2646970667358221220022b6bb97dd1e16cb867add83d4159f7550336cbb5b40514145e43f493c1377664736f6c634300080c0033","0x6a1e9826",["address[]","uint256","address","bytes","address","address","uint256","address","address"],"0xf34308ef",["address","uint256","bytes","uint8","address","address","uint256"])||this).entrypointAddress=void 0,i.candideAccountFactory=void 0,i.entrypointAddress=r,i.candideAccountFactory=n,i}u(r,e);var n=r.prototype;return n.createNewAccount=function(e,r,n,i){void 0===r&&(r=1),void 0===n&&(n=0),void 0===i&&(i=t.ZeroAddress);var o=this.getInitializerCallData([e,r,t.ZeroAddress,"0x",i,t.ZeroAddress,0,t.ZeroAddress,this.entrypointAddress]);return[this.getProxyAddress(o,this.candideAccountFactory.address,n),this.candideAccountFactory.getFactoryGeneratorFunctionCallData([this.singletonAddress,o,n])]},n.createSendEthCallData=function(e,r){return this.createCallData(e,r,"0x",0,t.ZeroAddress,t.ZeroAddress,0)},n.createCallData=function(e,t,r,n,i,o,s){return this.getExecutorCallData([e,t,r,n,i,o,s])},r}(c),h=/*#__PURE__*/function(){function e(e,t){this.rpcUrl=void 0,this.entrypointAddress=void 0,this.rpcUrl=e,this.entrypointAddress=t}var t=e.prototype;return t.chainId=function(){try{return Promise.resolve(this.sendJsonRpcRequest(this.rpcUrl,"eth_chainId",[])).then(function(e){return"result"in e?{chainId:e.result}:e.error})}catch(e){return Promise.reject(e)}},t.supportedEntryPoints=function(){try{return Promise.resolve(this.sendJsonRpcRequest(this.rpcUrl,"eth_supportedEntryPoints",[])).then(function(e){return"result"in e?{supportedEntryPoints:e.result}:e.error})}catch(e){return Promise.reject(e)}},t.estimateUserOperationGas=function(e){try{var t=this;return Promise.resolve(t.sendJsonRpcRequest(t.rpcUrl,"eth_estimateUserOperationGas",[e,t.entrypointAddress])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},t.sendUserOperation=function(e){try{var t=this;return Promise.resolve(t.sendJsonRpcRequest(t.rpcUrl,"eth_sendUserOperation",[e,t.entrypointAddress])).then(function(e){return"result"in e?{userOperationHash:e.result}:e.error})}catch(e){return Promise.reject(e)}},t.getUserOperationReceipt=function(e){try{return Promise.resolve(this.sendJsonRpcRequest(this.rpcUrl,"eth_getUserOperationReceipt",[e])).then(function(e){if("result"in e){var t=e.result,r=a({},t.receipt,{logs:JSON.stringify(t.receipt.logs)});return a({},t,{logs:JSON.stringify(t.logs),receipt:r})}return e.error})}catch(e){return Promise.reject(e)}},t.getUserOperationByHash=function(e){try{return Promise.resolve(this.sendJsonRpcRequest(this.rpcUrl,"eth_getUserOperationByHash",[e])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},t.sendJsonRpcRequest=function(e,t,r){try{var n=i.default||i,o=JSON.stringify({method:t,params:r,id:1,jsonrpc:"2.0"});return Promise.resolve(n(e,{method:"POST",headers:{"Content-Type":"application/json"},body:o,redirect:"follow"})).then(function(e){return Promise.resolve(e.text()).then(JSON.parse)})}catch(e){return Promise.reject(e)}},e}(),y={sender:t.ZeroAddress,nonce:0,initCode:"0x",callData:"0x",callGasLimit:0,verificationGasLimit:0,preVerificationGas:0,maxFeePerGas:0,maxPriorityFeePerGas:0,paymasterAndData:"0x",signature:"0x"},b={__proto__:null,SmartAccount:c,CandideAccount:p,SmartAccountFactory:l,CandideAccountFactory:f,Bundler:h,getUserOperationHash:o,UserOperationEmptyValues:y};e.Bundler=h,e.CandideAccount=p,e.CandideAccountFactory=f,e.SmartAccount=c,e.SmartAccountFactory=l,e.UserOperationEmptyValues=y,e.abstractionkit=b,e.getUserOperationHash=o});
@@ -0,0 +1,5 @@
1
+ import { Paymaster } from "./Paymaster";
2
+ export declare class CandideValidationPaymaster extends Paymaster {
3
+ constructor(address: string);
4
+ }
5
+ //# sourceMappingURL=CandideValidationPaymaster.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CandideValidationPaymaster.d.ts","sourceRoot":"","sources":["../../src/paymaster/CandideValidationPaymaster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,0BAA2B,SAAQ,SAAS;gBAC5C,OAAO,EAAE,MAAM;CAG3B"}
@@ -0,0 +1,10 @@
1
+ import "ethers";
2
+ import type { BytesLike } from "ethers";
3
+ import type { UserOperation, AbiInputValue } from "src/types";
4
+ export declare abstract class Paymaster {
5
+ readonly address: string;
6
+ constructor(address: string);
7
+ abstract getPaymasterCallData(userOperation: UserOperation, config: AbiInputValue): BytesLike;
8
+ abstract getPaymasterCallDataAndEstimateGas(userOperation: UserOperation, config: AbiInputValue): UserOperation;
9
+ }
10
+ //# sourceMappingURL=Paymaster.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Paymaster.d.ts","sourceRoot":"","sources":["../../src/paymaster/Paymaster.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE9D,8BAAsB,SAAS;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM;IAI3B,QAAQ,CAAC,oBAAoB,CAC5B,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,aAAa,GACnB,SAAS;IACZ,QAAQ,CAAC,kCAAkC,CAC1C,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,aAAa,GACnB,aAAa;CAChB"}
@@ -0,0 +1,66 @@
1
+ import type { BigNumberish, BytesLike } from "ethers";
2
+ export type UserOperation = {
3
+ sender: string;
4
+ nonce: BigNumberish;
5
+ initCode: BytesLike;
6
+ callData: BytesLike;
7
+ callGasLimit: BigNumberish;
8
+ verificationGasLimit: BigNumberish;
9
+ preVerificationGas: BigNumberish;
10
+ maxFeePerGas: BigNumberish;
11
+ maxPriorityFeePerGas: BigNumberish;
12
+ paymasterAndData: BytesLike;
13
+ signature: BytesLike;
14
+ };
15
+ export type AbiInputValue = string | BigNumberish | BytesLike | boolean | UserOperation | AbiInputValue[];
16
+ export type JsonRpcResponse = {
17
+ id: number;
18
+ result?: JsonRpcResult;
19
+ error?: JsonRpcError;
20
+ };
21
+ export type JsonRpcResult = string | string[] | GasEstimationResult | UserOperationByHashResult | UserOperationReceipt | UserOperationReceiptResult;
22
+ export type JsonRpcError = {
23
+ code: number;
24
+ message: string;
25
+ };
26
+ export type GasEstimationResult = {
27
+ callGasLimit: BigNumberish;
28
+ preVerificationGas: BigNumberish;
29
+ verificationGas: BigNumberish;
30
+ deadline: BigNumberish;
31
+ };
32
+ export type UserOperationByHashResult = {
33
+ userOperation: UserOperation;
34
+ entryPoint: string;
35
+ blockNumber: BigNumberish;
36
+ blockHash: BytesLike;
37
+ transactionHash: BytesLike;
38
+ };
39
+ export type UserOperationReceipt = {
40
+ blockHash: BytesLike;
41
+ blockNumber: BigNumberish;
42
+ from: string;
43
+ cumulativeGasUsed: BigNumberish;
44
+ gasUsed: BigNumberish;
45
+ logs: string;
46
+ logsBloom: string;
47
+ transactionHash: BytesLike;
48
+ transactionIndex: BigNumberish;
49
+ };
50
+ export type UserOperationReceiptResult = {
51
+ userOpHash: BytesLike;
52
+ entryPoint: string;
53
+ sender: string;
54
+ nonce: BigNumberish;
55
+ paymaster: string;
56
+ actualGasCost: BigNumberish;
57
+ actualGasUsed: BigNumberish;
58
+ success: string;
59
+ logs: string;
60
+ receipt: UserOperationReceipt;
61
+ };
62
+ export declare enum Operation {
63
+ Call = 0,
64
+ Delegate = 1
65
+ }
66
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEtD,MAAM,MAAM,aAAa,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,EAAE,YAAY,CAAC;IAC3B,oBAAoB,EAAE,YAAY,CAAC;IACnC,kBAAkB,EAAE,YAAY,CAAC;IACjC,YAAY,EAAE,YAAY,CAAC;IAC3B,oBAAoB,EAAE,YAAY,CAAC;IACnC,gBAAgB,EAAE,SAAS,CAAC;IAC5B,SAAS,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,aAAa,GACtB,MAAM,GACN,YAAY,GACZ,SAAS,GACT,OAAO,GACP,aAAa,GACb,aAAa,EAAE,CAAC;AAEnB,MAAM,MAAM,eAAe,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,aAAa,GACtB,MAAM,GACN,MAAM,EAAE,GACR,mBAAmB,GACnB,yBAAyB,GACzB,oBAAoB,GACpB,0BAA0B,CAAC;AAE9B,MAAM,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,YAAY,EAAE,YAAY,CAAC;IAC3B,kBAAkB,EAAE,YAAY,CAAC;IACjC,eAAe,EAAE,YAAY,CAAC;IAC9B,QAAQ,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACvC,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,YAAY,CAAC;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,EAAE,SAAS,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAClC,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,YAAY,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,YAAY,CAAC;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,SAAS,CAAC;IAC3B,gBAAgB,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACxC,UAAU,EAAE,SAAS,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,YAAY,CAAC;IAC5B,aAAa,EAAE,YAAY,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,oBAAoB,CAAC;CAC9B,CAAC;AAEF,oBAAY,SAAS;IACpB,IAAI,IAAI;IACR,QAAQ,IAAI;CACZ"}
@@ -0,0 +1,6 @@
1
+ import type { AddressLike, BytesLike, BigNumberish } from "ethers";
2
+ import type { AbiInputValue, UserOperation } from "./types";
3
+ export declare function getUserOperationHash(useroperation: UserOperation, entrypointAddress: AddressLike, chainId: BigNumberish): BytesLike;
4
+ export declare function getPackedUserOperation(useroperation: UserOperation): BytesLike;
5
+ export declare function getCallData(functionSelector: string, functionInputAbi: string[], functionInputParameters: AbiInputValue[]): BytesLike;
6
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE5D,wBAAgB,oBAAoB,CACnC,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,WAAW,EAC9B,OAAO,EAAE,YAAY,GACnB,SAAS,CAcX;AAED,wBAAgB,sBAAsB,CACrC,aAAa,EAAE,aAAa,GAC1B,SAAS,CA+BX;AAED,wBAAgB,WAAW,CAC1B,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,MAAM,EAAE,EAC1B,uBAAuB,EAAE,aAAa,EAAE,GACtC,SAAS,CASX"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "abstractionkit",
3
+ "author": {
4
+ "name": "Candidelabs",
5
+ "url": "https://candide.dev"
6
+ },
7
+ "version": "0.0.1",
8
+ "description": "Account Abstraction 4337 SDK by Candidelabs",
9
+ "main": "dist/index.js",
10
+ "module": "dist/index.m.js",
11
+ "unpkg": "dist/index.umd.js",
12
+ "types": "dist/index.d.ts",
13
+ "scripts": {
14
+ "build": "rm -rf dist && microbundle --tsconfig tsconfig.json --no-sourcemap",
15
+ "clean": "rm -rf dist",
16
+ "format": "prettier --write .",
17
+ "lint": "eslint src/**/*.ts",
18
+ "prepare": "husky install"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "keywords": [
24
+ "Account Abstraction",
25
+ "4337",
26
+ "Useroperation",
27
+ "Bundler",
28
+ "Paymaster",
29
+ "Entrypoint",
30
+ "SDK"
31
+ ],
32
+ "license": "MIT",
33
+ "publishConfig": {
34
+ "access": "public",
35
+ "tag": "latest"
36
+ },
37
+ "dependencies": {
38
+ "ethers": "^6.6.4",
39
+ "isomorphic-unfetch": "^4.0.2"
40
+ },
41
+ "devDependencies": {
42
+ "@typescript-eslint/eslint-plugin": "^6.2.0",
43
+ "@typescript-eslint/parser": "^6.2.0",
44
+ "eslint": "^8.46.0",
45
+ "husky": ">=6",
46
+ "lint-staged": ">=10",
47
+ "microbundle": "^0.15.1",
48
+ "prettier": "3.0.0",
49
+ "typescript": "^5.1.6"
50
+ },
51
+ "lint-staged": {
52
+ "*.js": "eslint --cache --fix",
53
+ "*.--write": "prettier --ignore-unknown --write"
54
+ }
55
+ }