abstractionkit 0.0.5 → 0.0.7

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.
@@ -1,7 +1,9 @@
1
1
  export { SmartAccount } from "./account/SmartAccount";
2
2
  export { CandideAccount } from "./account/CandideAccount";
3
+ export { SimpleAccount } from "./account/SimpleAccount";
3
4
  export { SmartAccountFactory } from "./factory/SmartAccountFactory";
4
5
  export { CandideAccountFactory } from "./factory/CandideAccountFactory";
6
+ export { SimpleAccountFactory } from "./factory/SimpleAccountFactory";
5
7
  export { Bundler } from "./Bundler";
6
8
  export { CandideValidationPaymaster } from "./paymaster/CandideValidationPaymaster";
7
9
  export { getUserOperationHash } from "./utils";
@@ -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,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
+ {"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;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE,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"}
@@ -11,5 +11,6 @@ export declare class CandideAccount extends SmartAccount {
11
11
  createNewAccount(owners: string[], threshold: BigNumberish, c2nonce: BigNumberish, fallbackHandler: string): [string, BytesLike];
12
12
  createSendEthCallData(to: string, value: BigNumberish): BytesLike;
13
13
  createCallData(to: string, value: BigNumberish, data: BytesLike, operation: Operation, paymaster: string, approveToken: string, approveAmount: BigNumberish): BytesLike;
14
+ getProxyAddress(initializerCallData: BytesLike, factoryAddress: string, c2Nonce: BigNumberish): string;
14
15
  }
15
16
  //# sourceMappingURL=CandideAccount.d.ts.map
@@ -1 +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"}
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;AAQ1C,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;IAaZ,eAAe,CACd,mBAAmB,EAAE,SAAS,EAC9B,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,YAAY,GACnB,MAAM;CAqBT"}
@@ -0,0 +1,17 @@
1
+ import { SmartAccount } from "./SmartAccount";
2
+ import type { BigNumberish, BytesLike } from "ethers";
3
+ import { SimpleAccountFactory } from "../factory/SimpleAccountFactory";
4
+ import { SmartAccountFactory } from "../factory/SmartAccountFactory";
5
+ export declare class SimpleAccount extends SmartAccount {
6
+ readonly entrypointAddress: string;
7
+ readonly simpleAccountFactory: SimpleAccountFactory;
8
+ readonly batchExecutorFunctionSelector: string;
9
+ readonly batchExecutorFunctionInputAbi: string[];
10
+ constructor(singletonAddress?: string, entrypointAddress?: string, simpleAccountFactory?: SmartAccountFactory);
11
+ createNewAccount(owner: string, c2nonce?: BigNumberish): [string, BytesLike];
12
+ getProxyAddress(initializerCallData: BytesLike, factoryAddress: string, c2Nonce: BigNumberish): string;
13
+ createSendEthCallData(to: string, value: BigNumberish): BytesLike;
14
+ createCallData(to: string, value: BigNumberish, data: BytesLike): BytesLike;
15
+ createBatchCallData(to_list: string[], data_list: BytesLike[]): BytesLike;
16
+ }
17
+ //# sourceMappingURL=SimpleAccount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleAccount.d.ts","sourceRoot":"","sources":["../../src/account/SimpleAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAO9C,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAIrE,qBAAa,aAAc,SAAQ,YAAY;IAC9C,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IACpD,QAAQ,CAAC,6BAA6B,EAAE,MAAM,CAAC;IAC/C,QAAQ,CAAC,6BAA6B,EAAE,MAAM,EAAE,CAAC;gBAGhD,gBAAgB,GAAE,MAAqD,EACvE,iBAAiB,GAAE,MAAqD,EACxE,oBAAoB,GAAE,mBAAgD;IA4BvE,gBAAgB,CACf,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,YAAgB,GACvB,CAAC,MAAM,EAAE,SAAS,CAAC;IA2BtB,eAAe,CACd,mBAAmB,EAAE,SAAS,EAC9B,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,YAAY,GACnB,MAAM;IAoBT,qBAAqB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,SAAS;IAIjE,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,GAAG,SAAS;IAS3E,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,SAAS;CASzE"}
@@ -1,4 +1,4 @@
1
- import type { BytesLike, BigNumberish } from "ethers";
1
+ import type { BytesLike } from "ethers";
2
2
  import { AbiInputValue } from "../types";
3
3
  export declare class SmartAccount {
4
4
  readonly singletonAddress: string;
@@ -10,6 +10,5 @@ export declare class SmartAccount {
10
10
  constructor(singletonAddress: string, proxyByteCode: BytesLike, initializerFunctionSelector: string, initializerFunctionInputAbi: string[], executorFunctionSelector: string, executorFunctionInputAbi: string[]);
11
11
  getInitializerCallData(initializerFunctionInputParameters: AbiInputValue[]): BytesLike;
12
12
  getExecutorCallData(executorFunctionInputParameters: AbiInputValue[]): BytesLike;
13
- getProxyAddress(initializerCallData: BytesLike, factoryAddress: string, c2Nonce: BigNumberish): string;
14
13
  }
15
14
  //# sourceMappingURL=SmartAccount.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"SmartAccount.d.ts","sourceRoot":"","sources":["../../src/account/SmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,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;CAQZ"}
@@ -0,0 +1,5 @@
1
+ import { SmartAccountFactory } from "./SmartAccountFactory";
2
+ export declare class SimpleAccountFactory extends SmartAccountFactory {
3
+ constructor(address?: string);
4
+ }
5
+ //# sourceMappingURL=SimpleAccountFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleAccountFactory.d.ts","sourceRoot":"","sources":["../../src/factory/SimpleAccountFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,qBAAa,oBAAqB,SAAQ,mBAAmB;gBAChD,OAAO,GAAE,MAAqD;CAK1E"}
package/dist/index.js CHANGED
@@ -1 +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")),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;
1
+ var e=require("isomorphic-unfetch"),t=require("ethers");function r(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 n=/*#__PURE__*/r(e),i=function(e,t,r){try{var i=n.default||n,f=JSON.stringify({method:t,params:r,id:1,jsonrpc:"2.0"});return Promise.resolve(i(e,{method:"POST",body:f,redirect:"follow"})).then(function(e){return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}};function f(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)),f=t.AbiCoder.defaultAbiCoder().encode(["bytes32","address","uint256"],[i,r,n]);return t.keccak256(f)}function c(e,r,n){return e+t.AbiCoder.defaultAbiCoder().encode(r,n).slice(2)}var o=/*#__PURE__*/function(){function e(e,t,r,n,i,f){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=f}var t=e.prototype;return t.getInitializerCallData=function(e){return c(this.initializerFunctionSelector,this.initializerFunctionInputAbi,e)},t.getExecutorCallData=function(e){return c(this.executorFunctionSelector,this.executorFunctionInputAbi,e)},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 s(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 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=c(this.generatorFunctionSelector,this.generatorFunctionInputAbi,e);return this.address+t.slice(2)},e}(),b=/*#__PURE__*/function(e){function t(t){return void 0===t&&(t="0xb73Eb505Abc30d0e7e15B73A492863235B3F4309"),e.call(this,t,"0x1688f0b9",["address","bytes","uint256"])||this}return s(t,e),t}(u),l=/*#__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 b),(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}s(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="0x2a15DE4410d4c8af0A7b6c12803120f43C42B820");var f=this.getInitializerCallData([e,r,t.ZeroAddress,"0x",i,t.ZeroAddress,0,t.ZeroAddress,this.entrypointAddress]);return[this.getProxyAddress(f,this.candideAccountFactory.address,n),this.candideAccountFactory.getFactoryGeneratorFunctionCallData([this.singletonAddress,f,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,f,c){return this.getExecutorCallData([e,t,r,n,i,f,c])},n.getProxyAddress=function(e,r,n){var i=t.keccak256(t.solidityPacked(["bytes32","uint256"],[t.keccak256(e),n])),f=t.keccak256(t.solidityPacked(["bytes","uint256"],[this.proxyByteCode,this.singletonAddress]));return"0x"+t.solidityPackedKeccak256(["bytes1","address","bytes32","bytes32"],["0xff",r,i,f]).slice(-40)},r}(o),p=/*#__PURE__*/function(e){function t(t){return void 0===t&&(t="0x9406Cc6185a346906296840746125a0E44976454"),e.call(this,t,"0x5fbfb9cf",["address","uint256"])||this}return s(t,e),t}(u),h=/*#__PURE__*/function(e){function r(t,r,n){var i;return void 0===t&&(t="0x8ABB13360b87Be5EEb1B98647A016adD927a136c"),void 0===r&&(r="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"),void 0===n&&(n=new p),(i=e.call(this,t,"0x60806040526040516107c13803806107c183398101604081905261002291610321565b61002e82826000610035565b505061043e565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d0838360405180606001604052806027815260200161079a602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100711760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103ef565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a357825160000361029c576001600160a01b0385163b61029c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102ad565b6102ad83836102b5565b949350505050565b8151156102c55781518083602001fd5b8060405162461bcd60e51b8152600401610148919061040b565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103105781810151838201526020016102f8565b838111156100645750506000910152565b6000806040838503121561033457600080fd5b82516001600160a01b038116811461034b57600080fd5b60208401519092506001600160401b038082111561036857600080fd5b818501915085601f83011261037c57600080fd5b81518181111561038e5761038e6102df565b604051601f8201601f19908116603f011681019083821181831017156103b6576103b66102df565b816040528281528860208487010111156103cf57600080fd5b6103e08360208301602088016102f5565b80955050505050509250929050565b600082516104018184602087016102f5565b9190910192915050565b602081526000825180602084015261042a8160408501602087016102f5565b601f01601f19169190910160400192915050565b61034d8061044d6000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102f1602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610283565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed919061029f565b60005b8381101561026e578181015183820152602001610256565b8381111561027d576000848401525b50505050565b60008251610295818460208701610253565b9190910192915050565b60208152600082518060208401526102be816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212201cd78ab6a31213989661cff2d7d05fc9b9c38b1a848e8249e2e398659a9eb7e364736f6c634300080f0033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564","0xc4d66de8",["address"],"0xb61d27f6",["address","uint256","bytes"])||this).entrypointAddress=void 0,i.simpleAccountFactory=void 0,i.batchExecutorFunctionSelector=void 0,i.batchExecutorFunctionInputAbi=void 0,i.entrypointAddress=r,i.simpleAccountFactory=n,i.batchExecutorFunctionSelector="0x18dfb3c7",i.batchExecutorFunctionInputAbi=["address[]","bytes[]"],i}s(r,e);var n=r.prototype;return n.createNewAccount=function(e,t){void 0===t&&(t=0);var r=this.getInitializerCallData([e]),n=this.simpleAccountFactory.getFactoryGeneratorFunctionCallData([e,t]);return[this.getProxyAddress(r,this.simpleAccountFactory.address,t),n]},n.getProxyAddress=function(e,r,n){var i=t.AbiCoder.defaultAbiCoder(),f=i.encode(["uint256"],[n]),c=i.encode(["address","bytes"],[this.singletonAddress,e]),o=t.keccak256(t.solidityPacked(["bytes","bytes"],[this.proxyByteCode,c]));return"0x"+t.solidityPackedKeccak256(["bytes1","address","bytes32","bytes32"],["0xff",r,f,o]).slice(-40)},n.createSendEthCallData=function(e,t){return this.createCallData(e,t,"0x")},n.createCallData=function(e,t,r){return this.getExecutorCallData([e,t,r])},n.createBatchCallData=function(e,t){return c(this.batchExecutorFunctionSelector,this.batchExecutorFunctionInputAbi,[e,t])},r}(o),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(i(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(i(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(i(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(i(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(i(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(i(this.rpcUrl,"eth_getUserOperationByHash",[e])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},e}(),x=/*#__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}s(t,e);var r=t.prototype;return r.getSupportedERC20Tokens=function(){try{return Promise.resolve(i(this.rpcUrl,"pm_supportedERC20Tokens",[])).then(function(e){if("result"in e){var t=e.result;return{tokens:t.tokens,paymasterMetadata:t.paymasterMetadata}}return e.error})}catch(e){return Promise.reject(e)}},r.getSupportedEntrypoint=function(){try{return Promise.resolve(i(this.rpcUrl,"pm_supportedEntryPoint",[])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},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(i(t[0],"pm_sponsorUserOperation",[e,t[1],{token:t[2]}])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},t}(function(){}),A={sender:t.ZeroAddress,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0x00",verificationGasLimit:"0x00",preVerificationGas:"0x00",maxFeePerGas:"0x00",maxPriorityFeePerGas:"0x00",paymasterAndData:"0x",signature:"0x"},v={sender:t.ZeroAddress,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0xffffff",verificationGasLimit:"0xffffff",preVerificationGas:"0xffffff",maxFeePerGas:"0xffffff",maxPriorityFeePerGas:"0xfffffff",paymasterAndData:"0x",signature:"0x"},m={__proto__:null,SmartAccount:o,CandideAccount:l,SimpleAccount:h,SmartAccountFactory:u,CandideAccountFactory:b,SimpleAccountFactory:p,Bundler:y,CandideValidationPaymaster:x,getUserOperationHash:f,UserOperationEmptyValues:A,UserOperationDummyValues:v};exports.Bundler=y,exports.CandideAccount=l,exports.CandideAccountFactory=b,exports.CandideValidationPaymaster=x,exports.SimpleAccount=h,exports.SimpleAccountFactory=p,exports.SmartAccount=o,exports.SmartAccountFactory=u,exports.UserOperationDummyValues=v,exports.UserOperationEmptyValues=A,exports.abstractionkit=m,exports.getUserOperationHash=f;
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.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
+ import*as t from"isomorphic-unfetch";import{keccak256 as e,AbiCoder as r,ZeroAddress as n,solidityPacked as f,solidityPackedKeccak256 as i}from"ethers";var a=function(e,r,n){try{var f=t.default||t,i=JSON.stringify({method:r,params:n,id:1,jsonrpc:"2.0"});return Promise.resolve(f(e,{method:"POST",body:i,redirect:"follow"})).then(function(t){return Promise.resolve(t.json())})}catch(t){return Promise.reject(t)}};function o(t,n,f){var i=e(function(t){var n=[t.sender,t.nonce,e(t.initCode),e(t.callData),t.callGasLimit,t.verificationGasLimit,t.preVerificationGas,t.maxFeePerGas,t.maxPriorityFeePerGas,e(t.paymasterAndData)];return r.defaultAbiCoder().encode(["address","uint256","bytes32","bytes32","uint256","uint256","uint256","uint256","uint256","bytes32"],n)}(t)),a=r.defaultAbiCoder().encode(["bytes32","address","uint256"],[i,n,f]);return e(a)}function c(t,e,n){return t+r.defaultAbiCoder().encode(e,n).slice(2)}var s=/*#__PURE__*/function(){function t(t,e,r,n,f,i){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=f,this.executorFunctionInputAbi=i}var e=t.prototype;return e.getInitializerCallData=function(t){return c(this.initializerFunctionSelector,this.initializerFunctionInputAbi,t)},e.getExecutorCallData=function(t){return c(this.executorFunctionSelector,this.executorFunctionInputAbi,t)},t}();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 u(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,b(t,e)}function b(t,e){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},b(t,e)}var l=/*#__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}(),p=/*#__PURE__*/function(t){function e(e){return void 0===e&&(e="0xb73Eb505Abc30d0e7e15B73A492863235B3F4309"),t.call(this,e,"0x1688f0b9",["address","bytes","uint256"])||this}return u(e,t),e}(l),h=/*#__PURE__*/function(t){function r(e,r,n){var f;return void 0===e&&(e="0x3A0a17Bcc84576b099373ab3Eed9702b07D30402"),void 0===r&&(r="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"),void 0===n&&(n=new p),(f=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,f.candideAccountFactory=void 0,f.entrypointAddress=r,f.candideAccountFactory=n,f}u(r,t);var a=r.prototype;return a.createNewAccount=function(t,e,r,f){void 0===e&&(e=1),void 0===r&&(r=0),void 0===f&&(f="0x2a15DE4410d4c8af0A7b6c12803120f43C42B820");var i=this.getInitializerCallData([t,e,n,"0x",f,n,0,n,this.entrypointAddress]);return[this.getProxyAddress(i,this.candideAccountFactory.address,r),this.candideAccountFactory.getFactoryGeneratorFunctionCallData([this.singletonAddress,i,r])]},a.createSendEthCallData=function(t,e){return this.createCallData(t,e,"0x",0,n,n,0)},a.createCallData=function(t,e,r,n,f,i,a){return this.getExecutorCallData([t,e,r,n,f,i,a])},a.getProxyAddress=function(t,r,n){var a=e(f(["bytes32","uint256"],[e(t),n])),o=e(f(["bytes","uint256"],[this.proxyByteCode,this.singletonAddress]));return"0x"+i(["bytes1","address","bytes32","bytes32"],["0xff",r,a,o]).slice(-40)},r}(s),y=/*#__PURE__*/function(t){function e(e){return void 0===e&&(e="0x9406Cc6185a346906296840746125a0E44976454"),t.call(this,e,"0x5fbfb9cf",["address","uint256"])||this}return u(e,t),e}(l),x=/*#__PURE__*/function(t){function n(e,r,n){var f;return void 0===e&&(e="0x8ABB13360b87Be5EEb1B98647A016adD927a136c"),void 0===r&&(r="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"),void 0===n&&(n=new y),(f=t.call(this,e,"0x60806040526040516107c13803806107c183398101604081905261002291610321565b61002e82826000610035565b505061043e565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d0838360405180606001604052806027815260200161079a602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100711760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103ef565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a357825160000361029c576001600160a01b0385163b61029c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102ad565b6102ad83836102b5565b949350505050565b8151156102c55781518083602001fd5b8060405162461bcd60e51b8152600401610148919061040b565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103105781810151838201526020016102f8565b838111156100645750506000910152565b6000806040838503121561033457600080fd5b82516001600160a01b038116811461034b57600080fd5b60208401519092506001600160401b038082111561036857600080fd5b818501915085601f83011261037c57600080fd5b81518181111561038e5761038e6102df565b604051601f8201601f19908116603f011681019083821181831017156103b6576103b66102df565b816040528281528860208487010111156103cf57600080fd5b6103e08360208301602088016102f5565b80955050505050509250929050565b600082516104018184602087016102f5565b9190910192915050565b602081526000825180602084015261042a8160408501602087016102f5565b601f01601f19169190910160400192915050565b61034d8061044d6000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102f1602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610283565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed919061029f565b60005b8381101561026e578181015183820152602001610256565b8381111561027d576000848401525b50505050565b60008251610295818460208701610253565b9190910192915050565b60208152600082518060208401526102be816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212201cd78ab6a31213989661cff2d7d05fc9b9c38b1a848e8249e2e398659a9eb7e364736f6c634300080f0033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564","0xc4d66de8",["address"],"0xb61d27f6",["address","uint256","bytes"])||this).entrypointAddress=void 0,f.simpleAccountFactory=void 0,f.batchExecutorFunctionSelector=void 0,f.batchExecutorFunctionInputAbi=void 0,f.entrypointAddress=r,f.simpleAccountFactory=n,f.batchExecutorFunctionSelector="0x18dfb3c7",f.batchExecutorFunctionInputAbi=["address[]","bytes[]"],f}u(n,t);var a=n.prototype;return a.createNewAccount=function(t,e){void 0===e&&(e=0);var r=this.getInitializerCallData([t]),n=this.simpleAccountFactory.getFactoryGeneratorFunctionCallData([t,e]);return[this.getProxyAddress(r,this.simpleAccountFactory.address,e),n]},a.getProxyAddress=function(t,n,a){var o=r.defaultAbiCoder(),c=o.encode(["uint256"],[a]),s=o.encode(["address","bytes"],[this.singletonAddress,t]),d=e(f(["bytes","bytes"],[this.proxyByteCode,s]));return"0x"+i(["bytes1","address","bytes32","bytes32"],["0xff",n,c,d]).slice(-40)},a.createSendEthCallData=function(t,e){return this.createCallData(t,e,"0x")},a.createCallData=function(t,e,r){return this.getExecutorCallData([t,e,r])},a.createBatchCallData=function(t,e){return c(this.batchExecutorFunctionSelector,this.batchExecutorFunctionInputAbi,[t,e])},n}(s),v=/*#__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(a(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(a(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(a(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(a(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(a(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(a(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}u(e,t);var r=e.prototype;return r.getSupportedERC20Tokens=function(){try{return Promise.resolve(a(this.rpcUrl,"pm_supportedERC20Tokens",[])).then(function(t){if("result"in t){var e=t.result;return{tokens:e.tokens,paymasterMetadata:e.paymasterMetadata}}return t.error})}catch(t){return Promise.reject(t)}},r.getSupportedEntrypoint=function(){try{return Promise.resolve(a(this.rpcUrl,"pm_supportedEntryPoint",[])).then(function(t){return"result"in t?t.result:t.error})}catch(t){return Promise.reject(t)}},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(a(e[0],"pm_sponsorUserOperation",[t,e[1],{token:e[2]}])).then(function(t){return"result"in t?t.result:t.error})}catch(t){return Promise.reject(t)}},e}(function(){}),A={sender:n,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0x00",verificationGasLimit:"0x00",preVerificationGas:"0x00",maxFeePerGas:"0x00",maxPriorityFeePerGas:"0x00",paymasterAndData:"0x",signature:"0x"},F={sender:n,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0xffffff",verificationGasLimit:"0xffffff",preVerificationGas:"0xffffff",maxFeePerGas:"0xffffff",maxPriorityFeePerGas:"0xfffffff",paymasterAndData:"0x",signature:"0x"},P={__proto__:null,SmartAccount:s,CandideAccount:h,SimpleAccount:x,SmartAccountFactory:l,CandideAccountFactory:p,SimpleAccountFactory:y,Bundler:v,CandideValidationPaymaster:m,getUserOperationHash:o,UserOperationEmptyValues:A,UserOperationDummyValues:F};export{v as Bundler,h as CandideAccount,p as CandideAccountFactory,m as CandideValidationPaymaster,x as SimpleAccount,y as SimpleAccountFactory,s as SmartAccount,l as SmartAccountFactory,F as UserOperationDummyValues,A as UserOperationEmptyValues,P as abstractionkit,o as getUserOperationHash};
@@ -1 +1 @@
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};
1
+ import*as t from"isomorphic-unfetch";import{keccak256 as e,AbiCoder as r,ZeroAddress as f,solidityPacked as s,solidityPackedKeccak256 as a}from"ethers";function i(t,f,s){const a=e(function(t){const f=[t.sender,t.nonce,e(t.initCode),e(t.callData),t.callGasLimit,t.verificationGasLimit,t.preVerificationGas,t.maxFeePerGas,t.maxPriorityFeePerGas,e(t.paymasterAndData)];return r.defaultAbiCoder().encode(["address","uint256","bytes32","bytes32","uint256","uint256","uint256","uint256","uint256","bytes32"],f)}(t)),i=r.defaultAbiCoder().encode(["bytes32","address","uint256"],[a,f,s]);return e(i)}function n(t,e,f){return t+r.defaultAbiCoder().encode(e,f).slice(2)}async function c(e,r,f){const s=t.default||t,a={method:"POST",body:JSON.stringify({method:r,params:f,id:1,jsonrpc:"2.0"}),redirect:"follow"},i=await s(e,a);return await i.json()}class o{constructor(t,e,r,f,s,a){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=f,this.executorFunctionSelector=s,this.executorFunctionInputAbi=a}getInitializerCallData(t){return n(this.initializerFunctionSelector,this.initializerFunctionInputAbi,t)}getExecutorCallData(t){return n(this.executorFunctionSelector,this.executorFunctionInputAbi,t)}}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=n(this.generatorFunctionSelector,this.generatorFunctionInputAbi,t);return this.address+e.slice(2)}}class b extends d{constructor(t="0xb73Eb505Abc30d0e7e15B73A492863235B3F4309"){super(t,"0x1688f0b9",["address","bytes","uint256"])}}class u extends o{constructor(t="0x3A0a17Bcc84576b099373ab3Eed9702b07D30402",e="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",r=new b){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="0x2a15DE4410d4c8af0A7b6c12803120f43C42B820"){const a=this.getInitializerCallData([t,e,f,"0x",s,f,0,f,this.entrypointAddress]);return[this.getProxyAddress(a,this.candideAccountFactory.address,r),this.candideAccountFactory.getFactoryGeneratorFunctionCallData([this.singletonAddress,a,r])]}createSendEthCallData(t,e){return this.createCallData(t,e,"0x",0,f,f,0)}createCallData(t,e,r,f,s,a,i){return this.getExecutorCallData([t,e,r,f,s,a,i])}getProxyAddress(t,r,f){const i=e(s(["bytes32","uint256"],[e(t),f])),n=e(s(["bytes","uint256"],[this.proxyByteCode,this.singletonAddress]));return"0x"+a(["bytes1","address","bytes32","bytes32"],["0xff",r,i,n]).slice(-40)}}class l extends d{constructor(t="0x9406Cc6185a346906296840746125a0E44976454"){super(t,"0x5fbfb9cf",["address","uint256"])}}class p extends o{constructor(t="0x8ABB13360b87Be5EEb1B98647A016adD927a136c",e="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",r=new l){super(t,"0x60806040526040516107c13803806107c183398101604081905261002291610321565b61002e82826000610035565b505061043e565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d0838360405180606001604052806027815260200161079a602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100711760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103ef565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a357825160000361029c576001600160a01b0385163b61029c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102ad565b6102ad83836102b5565b949350505050565b8151156102c55781518083602001fd5b8060405162461bcd60e51b8152600401610148919061040b565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103105781810151838201526020016102f8565b838111156100645750506000910152565b6000806040838503121561033457600080fd5b82516001600160a01b038116811461034b57600080fd5b60208401519092506001600160401b038082111561036857600080fd5b818501915085601f83011261037c57600080fd5b81518181111561038e5761038e6102df565b604051601f8201601f19908116603f011681019083821181831017156103b6576103b66102df565b816040528281528860208487010111156103cf57600080fd5b6103e08360208301602088016102f5565b80955050505050509250929050565b600082516104018184602087016102f5565b9190910192915050565b602081526000825180602084015261042a8160408501602087016102f5565b601f01601f19169190910160400192915050565b61034d8061044d6000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102f1602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610283565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed919061029f565b60005b8381101561026e578181015183820152602001610256565b8381111561027d576000848401525b50505050565b60008251610295818460208701610253565b9190910192915050565b60208152600082518060208401526102be816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212201cd78ab6a31213989661cff2d7d05fc9b9c38b1a848e8249e2e398659a9eb7e364736f6c634300080f0033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564","0xc4d66de8",["address"],"0xb61d27f6",["address","uint256","bytes"]),this.entrypointAddress=void 0,this.simpleAccountFactory=void 0,this.batchExecutorFunctionSelector=void 0,this.batchExecutorFunctionInputAbi=void 0,this.entrypointAddress=e,this.simpleAccountFactory=r,this.batchExecutorFunctionSelector="0x18dfb3c7",this.batchExecutorFunctionInputAbi=["address[]","bytes[]"]}createNewAccount(t,e=0){const r=this.getInitializerCallData([t]),f=this.simpleAccountFactory.getFactoryGeneratorFunctionCallData([t,e]);return[this.getProxyAddress(r,this.simpleAccountFactory.address,e),f]}getProxyAddress(t,f,i){const n=r.defaultAbiCoder(),c=n.encode(["uint256"],[i]),o=n.encode(["address","bytes"],[this.singletonAddress,t]),d=e(s(["bytes","bytes"],[this.proxyByteCode,o]));return"0x"+a(["bytes1","address","bytes32","bytes32"],["0xff",f,c,d]).slice(-40)}createSendEthCallData(t,e){return this.createCallData(t,e,"0x")}createCallData(t,e,r){return this.getExecutorCallData([t,e,r])}createBatchCallData(t,e){return n(this.batchExecutorFunctionSelector,this.batchExecutorFunctionInputAbi,[t,e])}}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 f in r)Object.prototype.hasOwnProperty.call(r,f)&&(t[f]=r[f])}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 x{}class A extends x{constructor(t,e){super(),this.rpcUrl=void 0,this.entrypointAddress=void 0,this.rpcUrl=e,this.entrypointAddress=t}async getSupportedERC20Tokens(){const t=await c(this.rpcUrl,"pm_supportedERC20Tokens",[]);if("result"in t){const e=t.result;return{tokens:e.tokens,paymasterMetadata:e.paymasterMetadata}}return t.error}async getSupportedEntrypoint(){const t=await c(this.rpcUrl,"pm_supportedEntryPoint",[]);return"result"in t?t.result:t.error}async getPaymasterCallDataForPayingGasWithErc20(t,e){return this.getPaymasterCallData(t,[this.rpcUrl,this.entrypointAddress,e])}async getPaymasterCallData(t,e){const r=e[0],f=e[1],s=e[2],a=await c(r,"pm_sponsorUserOperation",[t,f,{token:s}]);return"result"in a?a.result:a.error}}const F={sender:f,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0x00",verificationGasLimit:"0x00",preVerificationGas:"0x00",maxFeePerGas:"0x00",maxPriorityFeePerGas:"0x00",paymasterAndData:"0x",signature:"0x"},g={sender:f,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0xffffff",verificationGasLimit:"0xffffff",preVerificationGas:"0xffffff",maxFeePerGas:"0xffffff",maxPriorityFeePerGas:"0xfffffff",paymasterAndData:"0x",signature:"0x"};var m={__proto__:null,SmartAccount:o,CandideAccount:u,SimpleAccount:p,SmartAccountFactory:d,CandideAccountFactory:b,SimpleAccountFactory:l,Bundler:y,CandideValidationPaymaster:A,getUserOperationHash:i,UserOperationEmptyValues:F,UserOperationDummyValues:g};export{y as Bundler,u as CandideAccount,b as CandideAccountFactory,A as CandideValidationPaymaster,p as SimpleAccount,l as SimpleAccountFactory,o as SmartAccount,d as SmartAccountFactory,g as UserOperationDummyValues,F as UserOperationEmptyValues,m as abstractionkit,i as getUserOperationHash};
package/dist/index.umd.js CHANGED
@@ -1 +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),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
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("isomorphic-unfetch"),require("ethers")):"function"==typeof define&&define.amd?define(["exports","isomorphic-unfetch","ethers"],t):t((e||self).abstractionkit={},e.isomorphicUnfetch,e.ethers)}(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(t),f=function(e,t,r){try{var n=i.default||i,f=JSON.stringify({method:t,params:r,id:1,jsonrpc:"2.0"});return Promise.resolve(n(e,{method:"POST",body:f,redirect:"follow"})).then(function(e){return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}};function c(e,t,n){var i=r.keccak256(function(e){var t=[e.sender,e.nonce,r.keccak256(e.initCode),r.keccak256(e.callData),e.callGasLimit,e.verificationGasLimit,e.preVerificationGas,e.maxFeePerGas,e.maxPriorityFeePerGas,r.keccak256(e.paymasterAndData)];return r.AbiCoder.defaultAbiCoder().encode(["address","uint256","bytes32","bytes32","uint256","uint256","uint256","uint256","uint256","bytes32"],t)}(e)),f=r.AbiCoder.defaultAbiCoder().encode(["bytes32","address","uint256"],[i,t,n]);return r.keccak256(f)}function o(e,t,n){return e+r.AbiCoder.defaultAbiCoder().encode(t,n).slice(2)}var a=/*#__PURE__*/function(){function e(e,t,r,n,i,f){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=f}var t=e.prototype;return t.getInitializerCallData=function(e){return o(this.initializerFunctionSelector,this.initializerFunctionInputAbi,e)},t.getExecutorCallData=function(e){return o(this.executorFunctionSelector,this.executorFunctionInputAbi,e)},e}();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 d(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 b=/*#__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 d(t,e),t}(b),p=/*#__PURE__*/function(e){function t(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}d(t,e);var n=t.prototype;return n.createNewAccount=function(e,t,n,i){void 0===t&&(t=1),void 0===n&&(n=0),void 0===i&&(i="0x2a15DE4410d4c8af0A7b6c12803120f43C42B820");var f=this.getInitializerCallData([e,t,r.ZeroAddress,"0x",i,r.ZeroAddress,0,r.ZeroAddress,this.entrypointAddress]);return[this.getProxyAddress(f,this.candideAccountFactory.address,n),this.candideAccountFactory.getFactoryGeneratorFunctionCallData([this.singletonAddress,f,n])]},n.createSendEthCallData=function(e,t){return this.createCallData(e,t,"0x",0,r.ZeroAddress,r.ZeroAddress,0)},n.createCallData=function(e,t,r,n,i,f,c){return this.getExecutorCallData([e,t,r,n,i,f,c])},n.getProxyAddress=function(e,t,n){var i=r.keccak256(r.solidityPacked(["bytes32","uint256"],[r.keccak256(e),n])),f=r.keccak256(r.solidityPacked(["bytes","uint256"],[this.proxyByteCode,this.singletonAddress]));return"0x"+r.solidityPackedKeccak256(["bytes1","address","bytes32","bytes32"],["0xff",t,i,f]).slice(-40)},t}(a),h=/*#__PURE__*/function(e){function t(t){return void 0===t&&(t="0x9406Cc6185a346906296840746125a0E44976454"),e.call(this,t,"0x5fbfb9cf",["address","uint256"])||this}return d(t,e),t}(b),y=/*#__PURE__*/function(e){function t(t,r,n){var i;return void 0===t&&(t="0x8ABB13360b87Be5EEb1B98647A016adD927a136c"),void 0===r&&(r="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"),void 0===n&&(n=new h),(i=e.call(this,t,"0x60806040526040516107c13803806107c183398101604081905261002291610321565b61002e82826000610035565b505061043e565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d0838360405180606001604052806027815260200161079a602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100711760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103ef565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a357825160000361029c576001600160a01b0385163b61029c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102ad565b6102ad83836102b5565b949350505050565b8151156102c55781518083602001fd5b8060405162461bcd60e51b8152600401610148919061040b565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103105781810151838201526020016102f8565b838111156100645750506000910152565b6000806040838503121561033457600080fd5b82516001600160a01b038116811461034b57600080fd5b60208401519092506001600160401b038082111561036857600080fd5b818501915085601f83011261037c57600080fd5b81518181111561038e5761038e6102df565b604051601f8201601f19908116603f011681019083821181831017156103b6576103b66102df565b816040528281528860208487010111156103cf57600080fd5b6103e08360208301602088016102f5565b80955050505050509250929050565b600082516104018184602087016102f5565b9190910192915050565b602081526000825180602084015261042a8160408501602087016102f5565b601f01601f19169190910160400192915050565b61034d8061044d6000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102f1602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610283565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed919061029f565b60005b8381101561026e578181015183820152602001610256565b8381111561027d576000848401525b50505050565b60008251610295818460208701610253565b9190910192915050565b60208152600082518060208401526102be816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212201cd78ab6a31213989661cff2d7d05fc9b9c38b1a848e8249e2e398659a9eb7e364736f6c634300080f0033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564","0xc4d66de8",["address"],"0xb61d27f6",["address","uint256","bytes"])||this).entrypointAddress=void 0,i.simpleAccountFactory=void 0,i.batchExecutorFunctionSelector=void 0,i.batchExecutorFunctionInputAbi=void 0,i.entrypointAddress=r,i.simpleAccountFactory=n,i.batchExecutorFunctionSelector="0x18dfb3c7",i.batchExecutorFunctionInputAbi=["address[]","bytes[]"],i}d(t,e);var n=t.prototype;return n.createNewAccount=function(e,t){void 0===t&&(t=0);var r=this.getInitializerCallData([e]),n=this.simpleAccountFactory.getFactoryGeneratorFunctionCallData([e,t]);return[this.getProxyAddress(r,this.simpleAccountFactory.address,t),n]},n.getProxyAddress=function(e,t,n){var i=r.AbiCoder.defaultAbiCoder(),f=i.encode(["uint256"],[n]),c=i.encode(["address","bytes"],[this.singletonAddress,e]),o=r.keccak256(r.solidityPacked(["bytes","bytes"],[this.proxyByteCode,c]));return"0x"+r.solidityPackedKeccak256(["bytes1","address","bytes32","bytes32"],["0xff",t,f,o]).slice(-40)},n.createSendEthCallData=function(e,t){return this.createCallData(e,t,"0x")},n.createCallData=function(e,t,r){return this.getExecutorCallData([e,t,r])},n.createBatchCallData=function(e,t){return o(this.batchExecutorFunctionSelector,this.batchExecutorFunctionInputAbi,[e,t])},t}(a),A=/*#__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(f(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(f(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(f(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(f(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(f(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(f(this.rpcUrl,"eth_getUserOperationByHash",[e])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},e}(),m=/*#__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.getSupportedERC20Tokens=function(){try{return Promise.resolve(f(this.rpcUrl,"pm_supportedERC20Tokens",[])).then(function(e){if("result"in e){var t=e.result;return{tokens:t.tokens,paymasterMetadata:t.paymasterMetadata}}return e.error})}catch(e){return Promise.reject(e)}},r.getSupportedEntrypoint=function(){try{return Promise.resolve(f(this.rpcUrl,"pm_supportedEntryPoint",[])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},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(f(t[0],"pm_sponsorUserOperation",[e,t[1],{token:t[2]}])).then(function(e){return"result"in e?e.result:e.error})}catch(e){return Promise.reject(e)}},t}(function(){}),x={sender:r.ZeroAddress,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0x00",verificationGasLimit:"0x00",preVerificationGas:"0x00",maxFeePerGas:"0x00",maxPriorityFeePerGas:"0x00",paymasterAndData:"0x",signature:"0x"},v={sender:r.ZeroAddress,nonce:"0x00",initCode:"0x",callData:"0x",callGasLimit:"0xffffff",verificationGasLimit:"0xffffff",preVerificationGas:"0xffffff",maxFeePerGas:"0xffffff",maxPriorityFeePerGas:"0xfffffff",paymasterAndData:"0x",signature:"0x"},F={__proto__:null,SmartAccount:a,CandideAccount:p,SimpleAccount:y,SmartAccountFactory:b,CandideAccountFactory:l,SimpleAccountFactory:h,Bundler:A,CandideValidationPaymaster:m,getUserOperationHash:c,UserOperationEmptyValues:x,UserOperationDummyValues:v};e.Bundler=A,e.CandideAccount=p,e.CandideAccountFactory=l,e.CandideValidationPaymaster=m,e.SimpleAccount=y,e.SimpleAccountFactory=h,e.SmartAccount=a,e.SmartAccountFactory=b,e.UserOperationDummyValues=v,e.UserOperationEmptyValues=x,e.abstractionkit=F,e.getUserOperationHash=c});
@@ -1,15 +1,12 @@
1
1
  import { Paymaster } from "./Paymaster";
2
- import { UserOperation, JsonRpcError } from "../types";
3
- import { BytesLike } from "ethers";
2
+ import { UserOperation, JsonRpcError, SupportedERC20Tokens, PmSponsorUserOperationResult } from "../types";
4
3
  export declare class CandideValidationPaymaster extends Paymaster {
5
4
  readonly rpcUrl: string;
6
5
  readonly entrypointAddress: string;
7
6
  constructor(entrypointAddress: string, rpcUrl: string);
8
- getPaymasterCallDataForPayingGasWithErc20(userOperation: UserOperation, erc20TokenAddress: string): Promise<{
9
- paymasterAndData: BytesLike;
10
- } | JsonRpcError>;
11
- getPaymasterCallData(userOperation: UserOperation, config: string[]): Promise<{
12
- paymasterAndData: BytesLike;
13
- } | JsonRpcError>;
7
+ getSupportedERC20Tokens(): Promise<SupportedERC20Tokens | JsonRpcError>;
8
+ getSupportedEntrypoint(): Promise<string | JsonRpcError>;
9
+ getPaymasterCallDataForPayingGasWithErc20(userOperation: UserOperation, erc20TokenAddress: string): Promise<PmSponsorUserOperationResult | JsonRpcError>;
10
+ getPaymasterCallData(userOperation: UserOperation, config: string[]): Promise<PmSponsorUserOperationResult | JsonRpcError>;
14
11
  }
15
12
  //# sourceMappingURL=CandideValidationPaymaster.d.ts.map
@@ -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;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
+ {"version":3,"file":"CandideValidationPaymaster.d.ts","sourceRoot":"","sources":["../../src/paymaster/CandideValidationPaymaster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EACN,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,4BAA4B,EAC5B,MAAM,UAAU,CAAC;AAElB,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,uBAAuB,IAAI,OAAO,CACvC,oBAAoB,GAAG,YAAY,CACnC;IAeK,sBAAsB,IAAI,OAAO,CAAC,MAAM,GAAG,YAAY,CAAC;IAcxD,yCAAyC,CAC9C,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,MAAM,GACvB,OAAO,CAAC,4BAA4B,GAAG,YAAY,CAAC;IAMjD,oBAAoB,CACzB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,4BAA4B,GAAG,YAAY,CAAC;CAiBvD"}
package/dist/types.d.ts CHANGED
@@ -19,7 +19,7 @@ export type JsonRpcResponse = {
19
19
  result?: JsonRpcResult;
20
20
  error?: JsonRpcError;
21
21
  };
22
- export type JsonRpcResult = string | string[] | GasEstimationResult | UserOperationByHashResult | UserOperationReceipt | UserOperationReceiptResult;
22
+ export type JsonRpcResult = string | string[] | GasEstimationResult | UserOperationByHashResult | UserOperationReceipt | UserOperationReceiptResult | SupportedERC20Tokens | PmSponsorUserOperationResult;
23
23
  export type JsonRpcError = {
24
24
  code: number;
25
25
  message: string;
@@ -27,8 +27,7 @@ export type JsonRpcError = {
27
27
  export type GasEstimationResult = {
28
28
  callGasLimit: BigNumberish;
29
29
  preVerificationGas: BigNumberish;
30
- verificationGas: BigNumberish;
31
- deadline: BigNumberish;
30
+ verificationGasLimit: BigNumberish;
32
31
  };
33
32
  export type UserOperationByHashResult = {
34
33
  userOperation: UserOperation;
@@ -60,8 +59,30 @@ export type UserOperationReceiptResult = {
60
59
  logs: string;
61
60
  receipt: UserOperationReceipt;
62
61
  };
62
+ export type PmSponsorUserOperationResult = {
63
+ paymasterAndData: BytesLike;
64
+ };
63
65
  export declare enum Operation {
64
66
  Call = 0,
65
67
  Delegate = 1
66
68
  }
69
+ export interface ERC20Token {
70
+ symbol: string;
71
+ address: string;
72
+ decimal: number;
73
+ fee: number;
74
+ exchangeRate: string;
75
+ }
76
+ export interface PaymasterMetadata {
77
+ name: string;
78
+ description: string;
79
+ icons: string[];
80
+ address: string;
81
+ sponsoredEventTopic: string;
82
+ dummyPaymasterAndData: string;
83
+ }
84
+ export interface SupportedERC20Tokens {
85
+ paymasterMetadata: PaymasterMetadata;
86
+ tokens: ERC20Token[];
87
+ }
67
88
  //# sourceMappingURL=types.d.ts.map
@@ -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,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"}
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,GAC1B,oBAAoB,GACpB,4BAA4B,CAAC;AAEhC,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,oBAAoB,EAAE,YAAY,CAAC;CACnC,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,MAAM,MAAM,4BAA4B,GAAG;IACzC,gBAAgB,EAAE,SAAS,CAAA;CAC5B,CAAA;AAED,oBAAY,SAAS;IACpB,IAAI,IAAI;IACR,QAAQ,IAAI;CACZ;AAED,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qBAAqB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACpC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,MAAM,EAAE,UAAU,EAAE,CAAC;CACrB"}
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { AddressLike, BytesLike, BigNumberish } from "ethers";
1
+ import type { BytesLike, BigNumberish } from "ethers";
2
2
  import type { AbiInputValue, UserOperation, JsonRpcResponse, JsonRpcParam } from "./types";
3
- export declare function getUserOperationHash(useroperation: UserOperation, entrypointAddress: AddressLike, chainId: BigNumberish): BytesLike;
3
+ export declare function getUserOperationHash(useroperation: UserOperation, entrypointAddress: string, 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
6
  export declare function sendJsonRpcRequest(rpcUrl: string, method: string, params: JsonRpcParam): Promise<JsonRpcResponse>;
@@ -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,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"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE3F,wBAAgB,oBAAoB,CACnC,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,MAAM,EACzB,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,CAmB1B"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Candidelabs",
5
5
  "url": "https://candide.dev"
6
6
  },
7
- "version": "0.0.5",
7
+ "version": "0.0.7",
8
8
  "description": "Account Abstraction 4337 SDK by Candidelabs",
9
9
  "main": "dist/index.js",
10
10
  "module": "dist/index.m.js",