abstractionkit 0.0.3 → 0.0.5

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.
@@ -5,6 +5,6 @@ export { CandideAccountFactory } from "./factory/CandideAccountFactory";
5
5
  export { Bundler } from "./Bundler";
6
6
  export { CandideValidationPaymaster } from "./paymaster/CandideValidationPaymaster";
7
7
  export { getUserOperationHash } from "./utils";
8
- export { UserOperationEmptyValues } from "./constants";
9
- export type { UserOperation, AbiInputValue, JsonRpcResponse, JsonRpcResult, JsonRpcError, GasEstimationResult, UserOperationByHashResult, UserOperationReceipt, UserOperationReceiptResult, } from "./types";
8
+ export { UserOperationEmptyValues, UserOperationDummyValues } from "./constants";
9
+ export type { UserOperation, AbiInputValue, JsonRpcParam, JsonRpcResponse, JsonRpcResult, JsonRpcError, GasEstimationResult, UserOperationByHashResult, UserOperationReceipt, UserOperationReceiptResult, } from "./types";
10
10
  //# sourceMappingURL=abstractionkit.d.ts.map
@@ -1 +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,EAAC,0BAA0B,EAAC,MAAM,wCAAwC,CAAA;AAEjF,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"}
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,EAAC,0BAA0B,EAAC,MAAM,wCAAwC,CAAA;AAEjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEjF,YAAY,EACX,aAAa,EACb,aAAa,EACb,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,GAC1B,MAAM,SAAS,CAAC"}
@@ -1,3 +1,4 @@
1
1
  import type { UserOperation } from "./types";
2
2
  export declare const UserOperationEmptyValues: UserOperation;
3
+ export declare const UserOperationDummyValues: UserOperation;
3
4
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +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"}
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;AAEF,eAAO,MAAM,wBAAwB,EAAE,aAYtC,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var t=require("ethers");function e(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,e}var r=/*#__PURE__*/e(require("isomorphic-unfetch")),n=function(t,e,n){try{var i=r.default||r,o=JSON.stringify({method:e,params:n,id:1,jsonrpc:"2.0"});return Promise.resolve(i(t,{method:"POST",headers:{"Content-Type":"application/json"},body:o,redirect:"follow"})).then(function(t){return Promise.resolve(t.text()).then(JSON.parse)})}catch(t){return Promise.reject(t)}};function i(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 o(e,r,n){return e+t.AbiCoder.defaultAbiCoder().encode(r,n).slice(2)}var s=/*#__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 r=e.prototype;return r.getInitializerCallData=function(t){return o(this.initializerFunctionSelector,this.initializerFunctionInputAbi,t)},r.getExecutorCallData=function(t){return o(this.executorFunctionSelector,this.executorFunctionInputAbi,t)},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(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},a.apply(this,arguments)}function c(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,u(t,e)}function u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},u(t,e)}var d=/*#__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=o(this.generatorFunctionSelector,this.generatorFunctionInputAbi,t);return this.address+e.slice(2)},t}(),l=/*#__PURE__*/function(t){function e(e){return void 0===e&&(e="0xb73Eb505Abc30d0e7e15B73A492863235B3F4309"),t.call(this,e,"0x1688f0b9",["address","bytes","uint256"])||this}return c(e,t),e}(d),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 l),(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}c(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(t,e,r,n,i,o,s){return this.getExecutorCallData([t,e,r,n,i,o,s])},r}(s),h=/*#__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(n(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(n(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{return Promise.resolve(n(this.rpcUrl,"eth_estimateUserOperationGas",[t,this.entrypointAddress])).then(function(t){return"result"in t?t.result:t.error})}catch(t){return Promise.reject(t)}},e.sendUserOperation=function(t){try{return Promise.resolve(n(this.rpcUrl,"eth_sendUserOperation",[t,this.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(n(this.rpcUrl,"eth_getUserOperationReceipt",[t])).then(function(t){if("result"in t){var e=t.result,r=a({},e.receipt,{logs:JSON.stringify(e.receipt.logs)});return a({},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(n(this.rpcUrl,"eth_getUserOperationByHash",[t])).then(function(t){return"result"in t?t.result:t.error})}catch(t){return Promise.reject(t)}},t}(),f=/*#__PURE__*/function(t){function e(e,r){var n;return(n=t.call(this)||this).rpcUrl=void 0,n.entrypointAddress=void 0,n.rpcUrl=r,n.entrypointAddress=e,n}c(e,t);var r=e.prototype;return r.getPaymasterCallDataForPayingGasWithErc20=function(t,e){try{var r=this;return Promise.resolve(r.getPaymasterCallData(t,[r.rpcUrl,r.entrypointAddress,e]))}catch(t){return Promise.reject(t)}},r.getPaymasterCallData=function(t,e){try{return Promise.resolve(n(e[0],"pm_sponsorUserOperation",[t,e[1],[e[2]]])).then(function(t){return"result"in t?{paymasterAndData:t.result}:t.error})}catch(t){return Promise.reject(t)}},e}(function(){}),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:s,CandideAccount:p,SmartAccountFactory:d,CandideAccountFactory:l,Bundler:h,CandideValidationPaymaster:f,getUserOperationHash:i,UserOperationEmptyValues:y};exports.Bundler=h,exports.CandideAccount=p,exports.CandideAccountFactory=l,exports.CandideValidationPaymaster=f,exports.SmartAccount=s,exports.SmartAccountFactory=d,exports.UserOperationEmptyValues=y,exports.abstractionkit=b,exports.getUserOperationHash=i;
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")),n=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.json())})}catch(e){return Promise.reject(e)}};function i(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 o(t,r,n){return t+e.AbiCoder.defaultAbiCoder().encode(r,n).slice(2)}var s=/*#__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 o(this.initializerFunctionSelector,this.initializerFunctionInputAbi,e)},r.getExecutorCallData=function(e){return o(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 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 c(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,u(e,t)}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}var d=/*#__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=o(this.generatorFunctionSelector,this.generatorFunctionInputAbi,e);return this.address+t.slice(2)},e}(),l=/*#__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}(d),f=/*#__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 l),(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}(s),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(n(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(n(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{return Promise.resolve(n(this.rpcUrl,"eth_estimateUserOperationGas",[e,this.entrypointAddress])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},t.sendUserOperation=function(e){try{return Promise.resolve(n(this.rpcUrl,"eth_sendUserOperation",[e,this.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(n(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(n(this.rpcUrl,"eth_getUserOperationByHash",[e])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},e}(),h=/*#__PURE__*/function(e){function t(t,r){var n;return(n=e.call(this)||this).rpcUrl=void 0,n.entrypointAddress=void 0,n.rpcUrl=r,n.entrypointAddress=t,n}c(t,e);var r=t.prototype;return r.getPaymasterCallDataForPayingGasWithErc20=function(e,t){try{var r=this;return Promise.resolve(r.getPaymasterCallData(e,[r.rpcUrl,r.entrypointAddress,t]))}catch(e){return Promise.reject(e)}},r.getPaymasterCallData=function(e,t){try{return Promise.resolve(n(t[0],"pm_sponsorUserOperation",[e,t[1],{token:t[2]}])).then(function(e){return"result"in e?{paymasterAndData:e.result}:e.error})}catch(e){return Promise.reject(e)}},t}(function(){}),y={sender:e.ZeroAddress,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0x00",verificationGasLimit:"0x00",preVerificationGas:"0x00",maxFeePerGas:"0x00",maxPriorityFeePerGas:"0x00",paymasterAndData:"0x",signature:"0x"},b={sender:e.ZeroAddress,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0xffffff",verificationGasLimit:"0xffffff",preVerificationGas:"0xffffff",maxFeePerGas:"0xffffff",maxPriorityFeePerGas:"0xfffffff",paymasterAndData:"0x",signature:"0x"},x={__proto__:null,SmartAccount:s,CandideAccount:f,SmartAccountFactory:d,CandideAccountFactory:l,Bundler:p,CandideValidationPaymaster:h,getUserOperationHash:i,UserOperationEmptyValues:y,UserOperationDummyValues:b};exports.Bundler=p,exports.CandideAccount=f,exports.CandideAccountFactory=l,exports.CandideValidationPaymaster=h,exports.SmartAccount=s,exports.SmartAccountFactory=d,exports.UserOperationDummyValues=b,exports.UserOperationEmptyValues=y,exports.abstractionkit=x,exports.getUserOperationHash=i;
package/dist/index.m.js CHANGED
@@ -1 +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";var s=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)}};function a(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 u=/*#__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])),a=t(r(["bytes","uint256"],[this.proxyByteCode,this.singletonAddress]));return"0x"+n(["bytes1","address","bytes32","bytes32"],["0xff",i,s,a]).slice(-40)},e}();function d(){return d=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},d.apply(this,arguments)}function l(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,p(t,e)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}var h=/*#__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}(),f=/*#__PURE__*/function(t){function e(e){return void 0===e&&(e="0xb73Eb505Abc30d0e7e15B73A492863235B3F4309"),t.call(this,e,"0x1688f0b9",["address","bytes","uint256"])||this}return l(e,t),e}(h),y=/*#__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 f),(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}l(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}(u),b=/*#__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(s(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(s(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{return Promise.resolve(s(this.rpcUrl,"eth_estimateUserOperationGas",[t,this.entrypointAddress])).then(function(t){return"result"in t?t.result:t.error})}catch(t){return Promise.reject(t)}},e.sendUserOperation=function(t){try{return Promise.resolve(s(this.rpcUrl,"eth_sendUserOperation",[t,this.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(s(this.rpcUrl,"eth_getUserOperationReceipt",[t])).then(function(t){if("result"in t){var e=t.result,r=d({},e.receipt,{logs:JSON.stringify(e.receipt.logs)});return d({},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(s(this.rpcUrl,"eth_getUserOperationByHash",[t])).then(function(t){return"result"in t?t.result:t.error})}catch(t){return Promise.reject(t)}},t}(),v=/*#__PURE__*/function(t){function e(e,r){var n;return(n=t.call(this)||this).rpcUrl=void 0,n.entrypointAddress=void 0,n.rpcUrl=r,n.entrypointAddress=e,n}l(e,t);var r=e.prototype;return r.getPaymasterCallDataForPayingGasWithErc20=function(t,e){try{var r=this;return Promise.resolve(r.getPaymasterCallData(t,[r.rpcUrl,r.entrypointAddress,e]))}catch(t){return Promise.reject(t)}},r.getPaymasterCallData=function(t,e){try{return Promise.resolve(s(e[0],"pm_sponsorUserOperation",[t,e[1],[e[2]]])).then(function(t){return"result"in t?{paymasterAndData:t.result}:t.error})}catch(t){return Promise.reject(t)}},e}(function(){}),m={sender:i,nonce:0,initCode:"0x",callData:"0x",callGasLimit:0,verificationGasLimit:0,preVerificationGas:0,maxFeePerGas:0,maxPriorityFeePerGas:0,paymasterAndData:"0x",signature:"0x"},A={__proto__:null,SmartAccount:u,CandideAccount:y,SmartAccountFactory:h,CandideAccountFactory:f,Bundler:b,CandideValidationPaymaster:v,getUserOperationHash:a,UserOperationEmptyValues:m};export{b as Bundler,y as CandideAccount,f as CandideAccountFactory,v as CandideValidationPaymaster,u as SmartAccount,h as SmartAccountFactory,m as UserOperationEmptyValues,A as abstractionkit,a as getUserOperationHash};
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";var s=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.json())})}catch(t){return Promise.reject(t)}};function a(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 u=/*#__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])),a=t(r(["bytes","uint256"],[this.proxyByteCode,this.singletonAddress]));return"0x"+n(["bytes1","address","bytes32","bytes32"],["0xff",i,s,a]).slice(-40)},e}();function d(){return d=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},d.apply(this,arguments)}function f(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 f(e,t),e}(p),y=/*#__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}f(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}(u),b=/*#__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(s(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(s(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{return Promise.resolve(s(this.rpcUrl,"eth_estimateUserOperationGas",[t,this.entrypointAddress])).then(function(t){return"result"in t?t.result:t.error})}catch(t){return Promise.reject(t)}},e.sendUserOperation=function(t){try{return Promise.resolve(s(this.rpcUrl,"eth_sendUserOperation",[t,this.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(s(this.rpcUrl,"eth_getUserOperationReceipt",[t])).then(function(t){if("result"in t){var e=t.result,r=d({},e.receipt,{logs:JSON.stringify(e.receipt.logs)});return d({},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(s(this.rpcUrl,"eth_getUserOperationByHash",[t])).then(function(t){return"result"in t?t.result:t.error})}catch(t){return Promise.reject(t)}},t}(),m=/*#__PURE__*/function(t){function e(e,r){var n;return(n=t.call(this)||this).rpcUrl=void 0,n.entrypointAddress=void 0,n.rpcUrl=r,n.entrypointAddress=e,n}f(e,t);var r=e.prototype;return r.getPaymasterCallDataForPayingGasWithErc20=function(t,e){try{var r=this;return Promise.resolve(r.getPaymasterCallData(t,[r.rpcUrl,r.entrypointAddress,e]))}catch(t){return Promise.reject(t)}},r.getPaymasterCallData=function(t,e){try{return Promise.resolve(s(e[0],"pm_sponsorUserOperation",[t,e[1],{token:e[2]}])).then(function(t){return"result"in t?{paymasterAndData:t.result}:t.error})}catch(t){return Promise.reject(t)}},e}(function(){}),v={sender:i,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0x00",verificationGasLimit:"0x00",preVerificationGas:"0x00",maxFeePerGas:"0x00",maxPriorityFeePerGas:"0x00",paymasterAndData:"0x",signature:"0x"},x={sender:i,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0xffffff",verificationGasLimit:"0xffffff",preVerificationGas:"0xffffff",maxFeePerGas:"0xffffff",maxPriorityFeePerGas:"0xfffffff",paymasterAndData:"0x",signature:"0x"},A={__proto__:null,SmartAccount:u,CandideAccount:y,SmartAccountFactory:p,CandideAccountFactory:h,Bundler:b,CandideValidationPaymaster:m,getUserOperationHash:a,UserOperationEmptyValues:v,UserOperationDummyValues:x};export{b as Bundler,y as CandideAccount,h as CandideAccountFactory,m as CandideValidationPaymaster,u as SmartAccount,p as SmartAccountFactory,x as UserOperationDummyValues,v as UserOperationEmptyValues,A as abstractionkit,a as getUserOperationHash};
@@ -1 +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)}async function c(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())}class d{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 u{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 l extends u{constructor(t="0xb73Eb505Abc30d0e7e15B73A492863235B3F4309"){super(t,"0x1688f0b9",["address","bytes","uint256"])}}class p extends d{constructor(t="0x3A0a17Bcc84576b099373ab3Eed9702b07D30402",e="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",r=new l){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 y{constructor(t,e){this.rpcUrl=void 0,this.entrypointAddress=void 0,this.rpcUrl=t,this.entrypointAddress=e}async chainId(){const t=await c(this.rpcUrl,"eth_chainId",[]);return"result"in t?{chainId:t.result}:t.error}async supportedEntryPoints(){const t=await c(this.rpcUrl,"eth_supportedEntryPoints",[]);return"result"in t?{supportedEntryPoints:t.result}:t.error}async estimateUserOperationGas(t){const e=await c(this.rpcUrl,"eth_estimateUserOperationGas",[t,this.entrypointAddress]);return"result"in e?e.result:e.error}async sendUserOperation(t){const e=await c(this.rpcUrl,"eth_sendUserOperation",[t,this.entrypointAddress]);return"result"in e?{userOperationHash:e.result}:e.error}async getUserOperationReceipt(t){const e=await c(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 c(this.rpcUrl,"eth_getUserOperationByHash",[t]);return"result"in e?e.result:e.error}}class b{}class f extends b{constructor(t,e){super(),this.rpcUrl=void 0,this.entrypointAddress=void 0,this.rpcUrl=e,this.entrypointAddress=t}async getPaymasterCallDataForPayingGasWithErc20(t,e){return this.getPaymasterCallData(t,[this.rpcUrl,this.entrypointAddress,e])}async getPaymasterCallData(t,e){const r=e[0],s=e[1],i=e[2],n=await c(r,"pm_sponsorUserOperation",[t,s,[i]]);return"result"in n?{paymasterAndData:n.result}:n.error}}const A={sender:i,nonce:0,initCode:"0x",callData:"0x",callGasLimit:0,verificationGasLimit:0,preVerificationGas:0,maxFeePerGas:0,maxPriorityFeePerGas:0,paymasterAndData:"0x",signature:"0x"};var g={__proto__:null,SmartAccount:d,CandideAccount:p,SmartAccountFactory:u,CandideAccountFactory:l,Bundler:y,CandideValidationPaymaster:f,getUserOperationHash:a,UserOperationEmptyValues:A};export{y as Bundler,p as CandideAccount,l as CandideAccountFactory,f as CandideValidationPaymaster,d as SmartAccount,u as SmartAccountFactory,A as UserOperationEmptyValues,g as abstractionkit,a as getUserOperationHash};
1
+ import{keccak256 as t,AbiCoder as e,solidityPacked as r,solidityPackedKeccak256 as i,ZeroAddress as s}from"ethers";import*as n from"isomorphic-unfetch";function a(r,i,s){const n=t(function(r){const i=[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"],i)}(r)),a=e.defaultAbiCoder().encode(["bytes32","address","uint256"],[n,i,s]);return t(a)}function o(t,r,i){return t+e.defaultAbiCoder().encode(r,i).slice(2)}async function c(t,e,r){const i=n.default||n,s={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:e,params:r,id:1,jsonrpc:"2.0"}),redirect:"follow"},a=await i(t,s);return await a.json()}class d{constructor(t,e,r,i,s,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=i,this.executorFunctionSelector=s,this.executorFunctionInputAbi=n}getInitializerCallData(t){return o(this.initializerFunctionSelector,this.initializerFunctionInputAbi,t)}getExecutorCallData(t){return o(this.executorFunctionSelector,this.executorFunctionInputAbi,t)}getProxyAddress(e,s,n){const a=t(r(["bytes32","uint256"],[t(e),n])),o=t(r(["bytes","uint256"],[this.proxyByteCode,this.singletonAddress]));return"0x"+i(["bytes1","address","bytes32","bytes32"],["0xff",s,a,o]).slice(-40)}}class u{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 l extends u{constructor(t="0xb73Eb505Abc30d0e7e15B73A492863235B3F4309"){super(t,"0x1688f0b9",["address","bytes","uint256"])}}class p extends d{constructor(t="0x3A0a17Bcc84576b099373ab3Eed9702b07D30402",e="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",r=new l){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,i=s){const n=this.getInitializerCallData([t,e,s,"0x",i,s,0,s,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,s,s,0)}createCallData(t,e,r,i,s,n,a){return this.getExecutorCallData([t,e,r,i,s,n,a])}}function f(){return f=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},f.apply(this,arguments)}class h{constructor(t,e){this.rpcUrl=void 0,this.entrypointAddress=void 0,this.rpcUrl=t,this.entrypointAddress=e}async chainId(){const t=await c(this.rpcUrl,"eth_chainId",[]);return"result"in t?{chainId:t.result}:t.error}async supportedEntryPoints(){const t=await c(this.rpcUrl,"eth_supportedEntryPoints",[]);return"result"in t?{supportedEntryPoints:t.result}:t.error}async estimateUserOperationGas(t){const e=await c(this.rpcUrl,"eth_estimateUserOperationGas",[t,this.entrypointAddress]);return"result"in e?e.result:e.error}async sendUserOperation(t){const e=await c(this.rpcUrl,"eth_sendUserOperation",[t,this.entrypointAddress]);return"result"in e?{userOperationHash:e.result}:e.error}async getUserOperationReceipt(t){const e=await c(this.rpcUrl,"eth_getUserOperationReceipt",[t]);if("result"in e){const t=e.result,r=f({},t.receipt,{logs:JSON.stringify(t.receipt.logs)});return f({},t,{logs:JSON.stringify(t.logs),receipt:r})}return e.error}async getUserOperationByHash(t){const e=await c(this.rpcUrl,"eth_getUserOperationByHash",[t]);return"result"in e?e.result:e.error}}class y{}class b extends y{constructor(t,e){super(),this.rpcUrl=void 0,this.entrypointAddress=void 0,this.rpcUrl=e,this.entrypointAddress=t}async getPaymasterCallDataForPayingGasWithErc20(t,e){return this.getPaymasterCallData(t,[this.rpcUrl,this.entrypointAddress,e])}async getPaymasterCallData(t,e){const r=e[0],i=e[1],s=e[2],n=await c(r,"pm_sponsorUserOperation",[t,i,{token:s}]);return"result"in n?{paymasterAndData:n.result}:n.error}}const x={sender:s,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0x00",verificationGasLimit:"0x00",preVerificationGas:"0x00",maxFeePerGas:"0x00",maxPriorityFeePerGas:"0x00",paymasterAndData:"0x",signature:"0x"},A={sender:s,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0xffffff",verificationGasLimit:"0xffffff",preVerificationGas:"0xffffff",maxFeePerGas:"0xffffff",maxPriorityFeePerGas:"0xfffffff",paymasterAndData:"0x",signature:"0x"};var F={__proto__:null,SmartAccount:d,CandideAccount:p,SmartAccountFactory:u,CandideAccountFactory:l,Bundler:h,CandideValidationPaymaster:b,getUserOperationHash:a,UserOperationEmptyValues:x,UserOperationDummyValues:A};export{h as Bundler,p as CandideAccount,l as CandideAccountFactory,b as CandideValidationPaymaster,d as SmartAccount,u as SmartAccountFactory,A as UserOperationDummyValues,x as UserOperationEmptyValues,F as abstractionkit,a as getUserOperationHash};
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("ethers"),require("isomorphic-unfetch")):"function"==typeof define&&define.amd?define(["exports","ethers","isomorphic-unfetch"],e):e((t||self).abstractionkit={},t.ethers,t.isomorphicUnfetch)}(this,function(t,e,r){function n(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,e}var i=/*#__PURE__*/n(r),o=function(t,e,r){try{var n=i.default||i,o=JSON.stringify({method:e,params:r,id:1,jsonrpc:"2.0"});return Promise.resolve(n(t,{method:"POST",headers:{"Content-Type":"application/json"},body:o,redirect:"follow"})).then(function(t){return Promise.resolve(t.text()).then(JSON.parse)})}catch(t){return Promise.reject(t)}};function s(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 a(t,r,n){return t+e.AbiCoder.defaultAbiCoder().encode(r,n).slice(2)}var c=/*#__PURE__*/function(){function t(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 r=t.prototype;return r.getInitializerCallData=function(t){return a(this.initializerFunctionSelector,this.initializerFunctionInputAbi,t)},r.getExecutorCallData=function(t){return a(this.executorFunctionSelector,this.executorFunctionInputAbi,t)},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 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 f=/*#__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=a(this.generatorFunctionSelector,this.generatorFunctionInputAbi,t);return this.address+e.slice(2)},t}(),p=/*#__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}(f),h=/*#__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 p),(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(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(t,e,r,n,i,o,s){return this.getExecutorCallData([t,e,r,n,i,o,s])},r}(c),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(o(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(o(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{return Promise.resolve(o(this.rpcUrl,"eth_estimateUserOperationGas",[t,this.entrypointAddress])).then(function(t){return"result"in t?t.result:t.error})}catch(t){return Promise.reject(t)}},e.sendUserOperation=function(t){try{return Promise.resolve(o(this.rpcUrl,"eth_sendUserOperation",[t,this.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(o(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(o(this.rpcUrl,"eth_getUserOperationByHash",[t])).then(function(t){return"result"in t?t.result:t.error})}catch(t){return Promise.reject(t)}},t}(),b=/*#__PURE__*/function(t){function e(e,r){var n;return(n=t.call(this)||this).rpcUrl=void 0,n.entrypointAddress=void 0,n.rpcUrl=r,n.entrypointAddress=e,n}d(e,t);var r=e.prototype;return r.getPaymasterCallDataForPayingGasWithErc20=function(t,e){try{var r=this;return Promise.resolve(r.getPaymasterCallData(t,[r.rpcUrl,r.entrypointAddress,e]))}catch(t){return Promise.reject(t)}},r.getPaymasterCallData=function(t,e){try{return Promise.resolve(o(e[0],"pm_sponsorUserOperation",[t,e[1],[e[2]]])).then(function(t){return"result"in t?{paymasterAndData:t.result}:t.error})}catch(t){return Promise.reject(t)}},e}(function(){}),A={sender:e.ZeroAddress,nonce:0,initCode:"0x",callData:"0x",callGasLimit:0,verificationGasLimit:0,preVerificationGas:0,maxFeePerGas:0,maxPriorityFeePerGas:0,paymasterAndData:"0x",signature:"0x"},v={__proto__:null,SmartAccount:c,CandideAccount:h,SmartAccountFactory:f,CandideAccountFactory:p,Bundler:y,CandideValidationPaymaster:b,getUserOperationHash:s,UserOperationEmptyValues:A};t.Bundler=y,t.CandideAccount=h,t.CandideAccountFactory=p,t.CandideValidationPaymaster=b,t.SmartAccount=c,t.SmartAccountFactory=f,t.UserOperationEmptyValues=A,t.abstractionkit=v,t.getUserOperationHash=s});
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),o=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.json())})}catch(e){return Promise.reject(e)}};function s(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 a(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 a(this.initializerFunctionSelector,this.initializerFunctionInputAbi,e)},r.getExecutorCallData=function(e){return a(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 u(){return u=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},u.apply(this,arguments)}function d(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,f(e,t)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(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=a(this.generatorFunctionSelector,this.generatorFunctionInputAbi,e);return this.address+t.slice(2)},e}(),p=/*#__PURE__*/function(e){function t(t){return void 0===t&&(t="0xb73Eb505Abc30d0e7e15B73A492863235B3F4309"),e.call(this,t,"0x1688f0b9",["address","bytes","uint256"])||this}return d(t,e),t}(l),h=/*#__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 p),(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}d(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),y=/*#__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(o(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(o(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{return Promise.resolve(o(this.rpcUrl,"eth_estimateUserOperationGas",[e,this.entrypointAddress])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},t.sendUserOperation=function(e){try{return Promise.resolve(o(this.rpcUrl,"eth_sendUserOperation",[e,this.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(o(this.rpcUrl,"eth_getUserOperationReceipt",[e])).then(function(e){if("result"in e){var t=e.result,r=u({},t.receipt,{logs:JSON.stringify(t.receipt.logs)});return u({},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(o(this.rpcUrl,"eth_getUserOperationByHash",[e])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},e}(),b=/*#__PURE__*/function(e){function t(t,r){var n;return(n=e.call(this)||this).rpcUrl=void 0,n.entrypointAddress=void 0,n.rpcUrl=r,n.entrypointAddress=t,n}d(t,e);var r=t.prototype;return r.getPaymasterCallDataForPayingGasWithErc20=function(e,t){try{var r=this;return Promise.resolve(r.getPaymasterCallData(e,[r.rpcUrl,r.entrypointAddress,t]))}catch(e){return Promise.reject(e)}},r.getPaymasterCallData=function(e,t){try{return Promise.resolve(o(t[0],"pm_sponsorUserOperation",[e,t[1],{token:t[2]}])).then(function(e){return"result"in e?{paymasterAndData:e.result}:e.error})}catch(e){return Promise.reject(e)}},t}(function(){}),m={sender:t.ZeroAddress,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0x00",verificationGasLimit:"0x00",preVerificationGas:"0x00",maxFeePerGas:"0x00",maxPriorityFeePerGas:"0x00",paymasterAndData:"0x",signature:"0x"},A={sender:t.ZeroAddress,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0xffffff",verificationGasLimit:"0xffffff",preVerificationGas:"0xffffff",maxFeePerGas:"0xffffff",maxPriorityFeePerGas:"0xfffffff",paymasterAndData:"0x",signature:"0x"},v={__proto__:null,SmartAccount:c,CandideAccount:h,SmartAccountFactory:l,CandideAccountFactory:p,Bundler:y,CandideValidationPaymaster:b,getUserOperationHash:s,UserOperationEmptyValues:m,UserOperationDummyValues:A};e.Bundler=y,e.CandideAccount=h,e.CandideAccountFactory=p,e.CandideValidationPaymaster=b,e.SmartAccount=c,e.SmartAccountFactory=l,e.UserOperationDummyValues=A,e.UserOperationEmptyValues=m,e.abstractionkit=v,e.getUserOperationHash=s});
@@ -1 +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,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,qBAAa,0BAA2B,SAAQ,SAAS;IACxD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;gBAGlC,iBAAiB,EAAC,MAAM,EACxB,MAAM,EAAE,MAAM;IAOT,yCAAyC,CAC9C,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAC,MAAM,GACtB,OAAO,CAAC;QAAC,gBAAgB,EAAE,SAAS,CAAA;KAAC,GAAG,YAAY,CAAC;IAMlD,oBAAoB,CACzB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EAAE,GACd,OAAO,CAAC;QAAC,gBAAgB,EAAE,SAAS,CAAA;KAAC,GAAG,YAAY,CAAC;CAiBxD"}
1
+ {"version":3,"file":"CandideValidationPaymaster.d.ts","sourceRoot":"","sources":["../../src/paymaster/CandideValidationPaymaster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,qBAAa,0BAA2B,SAAQ,SAAS;IACxD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;gBAEvB,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAM/C,yCAAyC,CAC9C,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,MAAM,GACvB,OAAO,CAAC;QAAE,gBAAgB,EAAE,SAAS,CAAA;KAAE,GAAG,YAAY,CAAC;IAMpD,oBAAoB,CACzB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EAAE,GACd,OAAO,CAAC;QAAE,gBAAgB,EAAE,SAAS,CAAA;KAAE,GAAG,YAAY,CAAC;CAiB1D"}
@@ -1,6 +1,6 @@
1
1
  import "ethers";
2
2
  import type { BytesLike } from "ethers";
3
- import type { UserOperation, JsonRpcError } from "src/types";
3
+ import type { UserOperation, JsonRpcError } from "../types";
4
4
  export declare abstract class Paymaster {
5
5
  abstract getPaymasterCallData(userOperation: UserOperation, config: string[]): Promise<{
6
6
  paymasterAndData: BytesLike;
@@ -1 +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,YAAY,EAAE,MAAM,WAAW,CAAC;AAE7D,8BAAsB,SAAS;IAC9B,QAAQ,CAAC,oBAAoB,CAC5B,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EAAE,GACd,OAAO,CAAC;QAAC,gBAAgB,EAAE,SAAS,CAAA;KAAC,GAAG,YAAY,CAAC;CACxD"}
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,YAAY,EAAE,MAAM,UAAU,CAAC;AAE5D,8BAAsB,SAAS;IAC9B,QAAQ,CAAC,oBAAoB,CAC5B,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EAAE,GACd,OAAO,CAAC;QAAE,gBAAgB,EAAE,SAAS,CAAA;KAAE,GAAG,YAAY,CAAC;CAC1D"}
package/dist/types.d.ts CHANGED
@@ -12,7 +12,8 @@ export type UserOperation = {
12
12
  paymasterAndData: BytesLike;
13
13
  signature: BytesLike;
14
14
  };
15
- export type AbiInputValue = string | BigNumberish | BytesLike | boolean | UserOperation | AbiInputValue[];
15
+ export type AbiInputValue = string | BigNumberish | BytesLike | boolean | AbiInputValue[];
16
+ export type JsonRpcParam = string | BigNumberish | BytesLike | boolean | object | JsonRpcParam[];
16
17
  export type JsonRpcResponse = {
17
18
  id: number;
18
19
  result?: JsonRpcResult;
@@ -1 +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"}
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,EAAE,CAAC;AAEnB,MAAM,MAAM,YAAY,GACrB,MAAM,GACN,YAAY,GACZ,SAAS,GACT,OAAO,GACP,MAAM,GACN,YAAY,EAAE,CAAC;AAElB,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"}
package/dist/utils.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { AddressLike, BytesLike, BigNumberish } from "ethers";
2
- import type { AbiInputValue, UserOperation, JsonRpcResponse } from "./types";
2
+ import type { AbiInputValue, UserOperation, JsonRpcResponse, JsonRpcParam } from "./types";
3
3
  export declare function getUserOperationHash(useroperation: UserOperation, entrypointAddress: AddressLike, chainId: BigNumberish): BytesLike;
4
4
  export declare function getPackedUserOperation(useroperation: UserOperation): BytesLike;
5
5
  export declare function getCallData(functionSelector: string, functionInputAbi: string[], functionInputParameters: AbiInputValue[]): BytesLike;
6
- export declare function sendJsonRpcRequest(rpcUrl: string, method: string, params: AbiInputValue): Promise<JsonRpcResponse>;
6
+ export declare function sendJsonRpcRequest(rpcUrl: string, method: string, params: JsonRpcParam): Promise<JsonRpcResponse>;
7
7
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE7E,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;AAED,wBAAsB,kBAAkB,CACvC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,GACnB,OAAO,CAAC,eAAe,CAAC,CAsB1B"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE3F,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;AAED,wBAAsB,kBAAkB,CACvC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,YAAY,GAClB,OAAO,CAAC,eAAe,CAAC,CAsB1B"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Candidelabs",
5
5
  "url": "https://candide.dev"
6
6
  },
7
- "version": "0.0.3",
7
+ "version": "0.0.5",
8
8
  "description": "Account Abstraction 4337 SDK by Candidelabs",
9
9
  "main": "dist/index.js",
10
10
  "module": "dist/index.m.js",
@@ -13,13 +13,13 @@
13
13
  "scripts": {
14
14
  "build": "rm -rf dist && microbundle --tsconfig tsconfig.json --no-sourcemap",
15
15
  "clean": "rm -rf dist",
16
- "format": "prettier --write .",
16
+ "format": "prettier --write src/**/*.ts",
17
17
  "lint": "eslint src/**/*.ts",
18
18
  "prepare": "husky install"
19
19
  },
20
20
  "repository": {
21
- "type": "git",
22
- "url": "git+https://github.com/candidelabs/abstractionkit.git"
21
+ "type": "git",
22
+ "url": "git+https://github.com/candidelabs/abstractionkit.git"
23
23
  },
24
24
  "files": [
25
25
  "dist"
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "ethers": "^6.6.4",
43
- "isomorphic-unfetch": "^4.0.2"
43
+ "isomorphic-unfetch": "^3.1.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@typescript-eslint/eslint-plugin": "^6.2.0",