permissionless 0.2.25 → 0.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/_cjs/accounts/biconomy/toBiconomySmartAccount.js +27 -0
- package/_cjs/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_cjs/accounts/etherspot/toEtherspotSmartAccount.js +4 -0
- package/_cjs/accounts/etherspot/toEtherspotSmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/abi/KernelV3FactoryAbi.js +16 -0
- package/_cjs/accounts/kernel/abi/KernelV3FactoryAbi.js.map +1 -0
- package/_cjs/accounts/kernel/toKernelSmartAccount.js +17 -4
- package/_cjs/accounts/kernel/toKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/utils/decodeCallData.js +36 -0
- package/_cjs/accounts/kernel/utils/decodeCallData.js.map +1 -0
- package/_cjs/accounts/light/toLightSmartAccount.js +81 -0
- package/_cjs/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_cjs/accounts/nexus/toNexusSmartAccount.js +4 -0
- package/_cjs/accounts/nexus/toNexusSmartAccount.js.map +1 -1
- package/_cjs/accounts/safe/toSafeSmartAccount.js +47 -0
- package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_cjs/accounts/simple/toSimpleSmartAccount.js +114 -0
- package/_cjs/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_cjs/accounts/thirdweb/toThirdwebSmartAccount.js +4 -0
- package/_cjs/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
- package/_cjs/accounts/thirdweb/utils/decodeCallData.js +83 -0
- package/_cjs/accounts/thirdweb/utils/decodeCallData.js.map +1 -0
- package/_cjs/accounts/trust/toTrustSmartAccount.js +4 -0
- package/_cjs/accounts/trust/toTrustSmartAccount.js.map +1 -1
- package/_cjs/accounts/trust/utils/decodeCallData.js +83 -0
- package/_cjs/accounts/trust/utils/decodeCallData.js.map +1 -0
- package/_cjs/utils/decode7579Calls.js +100 -0
- package/_cjs/utils/decode7579Calls.js.map +1 -0
- package/_cjs/utils/getEstimationCallData.js +220 -0
- package/_cjs/utils/getEstimationCallData.js.map +1 -0
- package/_cjs/utils/index.js +3 -1
- package/_cjs/utils/index.js.map +1 -1
- package/_esm/accounts/biconomy/toBiconomySmartAccount.js +28 -1
- package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_esm/accounts/etherspot/toEtherspotSmartAccount.js +4 -0
- package/_esm/accounts/etherspot/toEtherspotSmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/abi/KernelV3FactoryAbi.js +13 -0
- package/_esm/accounts/kernel/abi/KernelV3FactoryAbi.js.map +1 -0
- package/_esm/accounts/kernel/toKernelSmartAccount.js +17 -4
- package/_esm/accounts/kernel/toKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/utils/decodeCallData.js +32 -0
- package/_esm/accounts/kernel/utils/decodeCallData.js.map +1 -0
- package/_esm/accounts/light/toLightSmartAccount.js +82 -1
- package/_esm/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_esm/accounts/nexus/toNexusSmartAccount.js +4 -0
- package/_esm/accounts/nexus/toNexusSmartAccount.js.map +1 -1
- package/_esm/accounts/safe/toSafeSmartAccount.js +56 -2
- package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_esm/accounts/simple/toSimpleSmartAccount.js +115 -1
- package/_esm/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_esm/accounts/thirdweb/toThirdwebSmartAccount.js +4 -0
- package/_esm/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
- package/_esm/accounts/thirdweb/utils/decodeCallData.js +79 -0
- package/_esm/accounts/thirdweb/utils/decodeCallData.js.map +1 -0
- package/_esm/accounts/trust/toTrustSmartAccount.js +4 -0
- package/_esm/accounts/trust/toTrustSmartAccount.js.map +1 -1
- package/_esm/accounts/trust/utils/decodeCallData.js +79 -0
- package/_esm/accounts/trust/utils/decodeCallData.js.map +1 -0
- package/_esm/utils/decode7579Calls.js +98 -0
- package/_esm/utils/decode7579Calls.js.map +1 -0
- package/_esm/utils/getEstimationCallData.js +217 -0
- package/_esm/utils/getEstimationCallData.js.map +1 -0
- package/_esm/utils/index.js +2 -1
- package/_esm/utils/index.js.map +1 -1
- package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
- package/_types/accounts/etherspot/toEtherspotSmartAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/abi/KernelV3FactoryAbi.d.ts +20 -0
- package/_types/accounts/kernel/abi/KernelV3FactoryAbi.d.ts.map +1 -0
- package/_types/accounts/kernel/toKernelSmartAccount.d.ts +1 -0
- package/_types/accounts/kernel/toKernelSmartAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/decodeCallData.d.ts +11 -0
- package/_types/accounts/kernel/utils/decodeCallData.d.ts.map +1 -0
- package/_types/accounts/light/toLightSmartAccount.d.ts.map +1 -1
- package/_types/accounts/nexus/toNexusSmartAccount.d.ts.map +1 -1
- package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
- package/_types/accounts/simple/toSimpleSmartAccount.d.ts.map +1 -1
- package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts.map +1 -1
- package/_types/accounts/thirdweb/utils/decodeCallData.d.ts +7 -0
- package/_types/accounts/thirdweb/utils/decodeCallData.d.ts.map +1 -0
- package/_types/accounts/trust/toTrustSmartAccount.d.ts.map +1 -1
- package/_types/accounts/trust/utils/decodeCallData.d.ts +7 -0
- package/_types/accounts/trust/utils/decodeCallData.d.ts.map +1 -0
- package/_types/utils/decode7579Calls.d.ts +12 -0
- package/_types/utils/decode7579Calls.d.ts.map +1 -0
- package/_types/utils/getEstimationCallData.d.ts +18 -0
- package/_types/utils/getEstimationCallData.d.ts.map +1 -0
- package/_types/utils/index.d.ts +2 -1
- package/_types/utils/index.d.ts.map +1 -1
- package/accounts/biconomy/toBiconomySmartAccount.ts +30 -0
- package/accounts/decodeCalls.test.ts +340 -0
- package/accounts/etherspot/toEtherspotSmartAccount.ts +4 -0
- package/accounts/kernel/abi/KernelV3FactoryAbi.ts +12 -0
- package/accounts/kernel/toKernelSmartAccount.ts +22 -4
- package/accounts/kernel/utils/decodeCallData.ts +43 -0
- package/accounts/light/toLightSmartAccount.ts +90 -0
- package/accounts/nexus/toNexusSmartAccount.ts +4 -0
- package/accounts/safe/toSafeSmartAccount.ts +85 -0
- package/accounts/simple/toSimpleSmartAccount.ts +127 -0
- package/accounts/thirdweb/toThirdwebSmartAccount.ts +4 -0
- package/accounts/thirdweb/utils/decodeCallData.ts +87 -0
- package/accounts/trust/toTrustSmartAccount.ts +4 -0
- package/accounts/trust/utils/decodeCallData.ts +87 -0
- package/package.json +1 -1
- package/utils/decode7579Calls.ts +133 -0
- package/utils/getEstimationCallData.ts +279 -0
- package/utils/index.ts +8 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toLightSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/light/toLightSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"toLightSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/light/toLightSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,YAAY,EAMpB,MAAM,MAAM,CAAA;AACb,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAE/B,eAAe,EACf,eAAe,EAIlB,MAAM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G,KAAK,EAE/C,UAAU,EAAE,6BAA6B,CAAC,iBAAiB,CAAC,GAC7D,OAAO,CAAC,6BAA6B,CAAC,iBAAiB,CAAC,CAAC,CAwT3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toNexusSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/nexus/toNexusSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,EACL,QAAQ,EACR,SAAS,EAET,YAAY,EACf,MAAM,MAAM,CAAA;AACb,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,MAAM,EAEX,KAAK,YAAY,EAcpB,MAAM,MAAM,CAAA;AACb,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,eAAe,EAIlB,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"toNexusSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/nexus/toNexusSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,EACL,QAAQ,EACR,SAAS,EAET,YAAY,EACf,MAAM,MAAM,CAAA;AACb,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,MAAM,EAEX,KAAK,YAAY,EAcpB,MAAM,MAAM,CAAA;AACb,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,eAAe,EAIlB,MAAM,0BAA0B,CAAA;AAMjC,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,wBAAwB,CAAA;AAiDvE,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAAC;IACjD,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE;QACJ,KAAK,CACC,gBAAgB,GAChB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,OAAO,CAAC,GACnD,YAAY,CACjB;KACJ,CAAA;IACD,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,UAAU,CAAC,EAAE;QACT,OAAO,EAAE,OAAO,CAAA;QAChB,OAAO,EAAE,KAAK,CAAA;KACjB,CAAA;IACD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,SAAS,CAAC,EAAE,OAAO,EAAE,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC,CAAA;AAEF,MAAM,MAAM,+BAA+B,GAAG,MAAM,CAChD,0BAA0B,CAAC,OAAO,eAAe,EAAE,KAAK,CAAC,EACzD;IAAE,IAAI,EAAE,WAAW,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CAC5D,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAChD,YAAY,CAAC,+BAA+B,CAAC,CAChD,CAAA;AAED,wBAAsB,mBAAmB,CACrC,UAAU,EAAE,6BAA6B,GAC1C,OAAO,CAAC,6BAA6B,CAAC,CAiNxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toSafeSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/safe/toSafeSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,MAAM,EAKX,KAAK,SAAS,EAGd,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"toSafeSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/safe/toSafeSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,MAAM,EAKX,KAAK,SAAS,EAGd,KAAK,YAAY,EAkBpB,M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G,gBAAgB,CAAC,QAAQ,CAAC,CAAA;AA8H9B,MAAM,MAAM,8BAA8B,CACtC,iBAAiB,SAAS,KAAK,GAAG,KAAK,GAAG,KAAK,IAC/C,MAAM,CACN,0BAA0B,CACtB,iBAAiB,SAAS,KAAK,GACzB,OAAO,eAAe,GACtB,OAAO,eAAe,EAC5B,iBAAiB,CAMpB,EACD;IAAE,IAAI,EAAE,WAAW,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CAC5D,CAAA;AAED,MAAM,MAAM,4BAA4B,CACpC,iBAAiB,SAAS,KAAK,GAAG,KAAK,GAAG,KAAK,IAC/C,YAAY,CAAC,8BAA8B,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAEnE;;;;GAIG;AACH,wBAAsB,kBAAkB,CACpC,iBAAiB,SAAS,KAAK,GAAG,KAAK,EACvC,QAAQ,SAAS,OAAO,GAAG,SAAS,EAEpC,UAAU,EAAE,4BAA4B,CAAC,iBAAiB,EAAE,QAAQ,CAAC,GACtE,OAAO,CAAC,4BAA4B,CAAC,iBAAiB,CAAC,CAAC,CA4f1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toSimpleSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/simple/toSimpleSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"toSimpleSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/simple/toSimpleSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,YAAY,EACjB,KAAK,KAAK,E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B,CAAC,GAC9D,OAAO,CAAC,8BAA8B,CAAC,iBAAiB,CAAC,CAAC,CA4U5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toThirdwebSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/thirdweb/toThirdwebSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,EACL,MAAM,EACN,YAAY,EACZ,KAAK,EACL,SAAS,EAET,YAAY,EACf,MAAM,MAAM,CAAA;AAIb,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAE/B,eAAe,EACf,eAAe,EAIlB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"toThirdwebSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/thirdweb/toThirdwebSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,EACL,MAAM,EACN,YAAY,EACZ,KAAK,EACL,SAAS,EAET,YAAY,EACf,MAAM,MAAM,CAAA;AAIb,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAE/B,eAAe,EACf,eAAe,EAIlB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,wBAAwB,CAAA;AAQvE;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;4BAIiC,OAAO;;;;;4BAMP,OAAO;;;CAGtE,CAAA;AAED,MAAM,MAAM,gCAAgC,CACxC,iBAAiB,SAAS,KAAK,GAAG,KAAK,GAAG,KAAK,IAC/C;IACA,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,KAAK,CACN,gBAAgB,GAChB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,OAAO,CAAC,GACnD,YA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AAG;YACD,MAAM;IAkDzB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toTrustSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/trust/toTrustSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,YAAY,EAGpB,MAAM,MAAM,CAAA;AAIb,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAE/B,eAAe,EAIlB,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"toTrustSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/trust/toTrustSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,YAAY,EAGpB,MAAM,MAAM,CAAA;AAIb,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAE/B,eAAe,EAIlB,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,wBAAwB,CAAA;AA4BvE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE;IAC1B,iCAAiC,EAAE,OAAO,CAAA;IAC1C,cAAc,EAAE,OAAO,CAAA;CAK1B,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,KAAK,CACN,gBAAgB,GAChB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,OAAO,CAAC,GACnD,YAAY,CACjB,CAAA;IACD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,UAAU,EAAE;QACR,OAAO,EAAE,OAAO,CAAA;QAChB,OAAO,EAAE,KAAK,CAAA;KACjB,CAAA;IACD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,iCAAiC,CAAC,EAAE,OAAO,CAAA;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,MAAM,CAChD,0BAA0B,CACtB,OAAO,eAAe,EACtB,KAAK,CAMR,EACD;IAAE,IAAI,EAAE,WAAW,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CAC5D,CAAA;AAED,MAAM,MAAM,6BAA6B,GACrC,YAAY,CAAC,+BAA+B,CAAC,CAAA;AAEjD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACrC,UAAU,EAAE,6BAA6B,GAC1C,OAAO,CAAC,6BAA6B,CAAC,CAqHxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decodeCallData.d.ts","sourceRoot":"","sources":["../../../../accounts/trust/utils/decodeCallData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAsB,MAAM,MAAM,CAAA;AAEjE,eAAO,MAAM,cAAc,aAAoB,KAAK,MAAM,EAAE;QAgC5C,OAAO;UACL,GAAG;YACD,MAAM;IAkDzB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
import type { CallType, ExecutionMode } from "../actions/erc7579/supportsExecutionMode.js";
|
|
3
|
+
export type DecodeCallDataReturnType = {
|
|
4
|
+
mode: ExecutionMode<CallType>;
|
|
5
|
+
callData: readonly {
|
|
6
|
+
to: Address;
|
|
7
|
+
value?: bigint | undefined;
|
|
8
|
+
data?: Hex | undefined;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
11
|
+
export declare function decode7579Calls(callData: Hex): DecodeCallDataReturnType;
|
|
12
|
+
//# sourceMappingURL=decode7579Calls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode7579Calls.d.ts","sourceRoot":"","sources":["../../utils/decode7579Calls.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,GAAG,EAMX,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EACR,QAAQ,EACR,aAAa,EAChB,MAAM,6CAA6C,CAAA;AAEpD,MAAM,MAAM,wBAAwB,GAAG;IACnC,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;IAC7B,QAAQ,EAAE,SAAS;QACf,EAAE,EAAE,OAAO,CAAA;QACX,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,EAAE,GAAG,GAAG,SAAS,CAAA;KACzB,EAAE,CAAA;CACN,CAAA;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,GAAG,GAAG,wBAAwB,CA6GvE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
import { type UserOperation } from "viem/account-abstraction";
|
|
3
|
+
export type GetPimlicoEstimationCallDataParams<entryPointVersion extends "0.6" | "0.7"> = {
|
|
4
|
+
userOperation: UserOperation<entryPointVersion>;
|
|
5
|
+
entrypoint: {
|
|
6
|
+
address: Address;
|
|
7
|
+
version: entryPointVersion;
|
|
8
|
+
};
|
|
9
|
+
} & (entryPointVersion extends "0.6" ? {
|
|
10
|
+
estimationAddress: never;
|
|
11
|
+
} : {
|
|
12
|
+
estimationAddress?: Address;
|
|
13
|
+
});
|
|
14
|
+
export declare function getPimlicoEstimationCallData<entryPointVersion extends "0.6" | "0.7">(args: GetPimlicoEstimationCallDataParams<entryPointVersion>): {
|
|
15
|
+
to: Address;
|
|
16
|
+
data: Hex;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=getEstimationCallData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEstimationCallData.d.ts","sourceRoot":"","sources":["../../utils/getEstimationCallData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAsB,MAAM,MAAM,CAAA;AACjE,OAAO,EACH,KAAK,aAAa,EAGrB,MAAM,0BAA0B,CAAA;AA4NjC,MAAM,MAAM,kCAAkC,CAC1C,iBAAiB,SAAS,KAAK,GAAG,KAAK,IACvC;IACA,aAAa,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAA;IAC/C,UAAU,EAAE;QACR,OAAO,EAAE,OAAO,CAAA;QAChB,OAAO,EAAE,iBAAiB,CAAA;KAC7B,CAAA;CACJ,GAAG,CAAC,iBAAiB,SAAS,KAAK,GAC9B;IACI,iBAAiB,EAAE,KAAK,CAAA;CAC3B,GACD;IAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAAA;AActC,wBAAgB,4BAA4B,CACxC,iBAAiB,SAAS,KAAK,GAAG,KAAK,EAEvC,IAAI,EAAE,kCAAkC,CAAC,iBAAiB,CAAC,GAC5D;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,CAuB5B"}
|
package/_types/utils/index.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ import { encodeNonce } from "./encodeNonce.js";
|
|
|
8
8
|
import { type EncodeInstallModuleParameters, encodeInstallModule } from "./encodeInstallModule.js";
|
|
9
9
|
import { getPackedUserOperation } from "./getPackedUserOperation.js";
|
|
10
10
|
import { type EncodeCallDataParams, encode7579Calls } from "./encode7579Calls.js";
|
|
11
|
+
import { type DecodeCallDataReturnType, decode7579Calls } from "./decode7579Calls.js";
|
|
11
12
|
import { type Erc20AllowanceOverrideParameters, erc20AllowanceOverride } from "./erc20AllowanceOverride.js";
|
|
12
13
|
import { type Erc20BalanceOverrideParameters, erc20BalanceOverride } from "./erc20BalanceOverride.js";
|
|
13
|
-
export { transactionReceiptStatus, deepHexlify, getRequiredPrefund, toOwner, type GetRequiredPrefundReturnType, isSmartAccountDeployed, getAddressFromInitCodeOrPaymasterAndData, getPackedUserOperation, encodeNonce, decodeNonce, type EncodeInstallModuleParameters, encodeInstallModule, type EncodeCallDataParams, encode7579Calls, erc20AllowanceOverride, erc20BalanceOverride, type Erc20AllowanceOverrideParameters, type Erc20BalanceOverrideParameters };
|
|
14
|
+
export { transactionReceiptStatus, deepHexlify, getRequiredPrefund, toOwner, type GetRequiredPrefundReturnType, isSmartAccountDeployed, getAddressFromInitCodeOrPaymasterAndData, getPackedUserOperation, encodeNonce, decodeNonce, type EncodeInstallModuleParameters, encodeInstallModule, type EncodeCallDataParams, encode7579Calls, decode7579Calls, type DecodeCallDataReturnType, erc20AllowanceOverride, erc20BalanceOverride, type Erc20AllowanceOverrideParameters, type Erc20BalanceOverrideParameters };
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,wCAAwC,EAAE,MAAM,+CAA+C,CAAA;AACxG,OAAO,EACH,KAAK,4BAA4B,EACjC,kBAAkB,EACrB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EACH,KAAK,6BAA6B,EAClC,mBAAmB,EACtB,MAAM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,eAAe,EACf,eAAe,EACf,KAAK,wBAAwB,EAC7B,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACtC,CAAA"}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
type Client,
|
|
13
13
|
type Hex,
|
|
14
14
|
type LocalAccount,
|
|
15
|
+
decodeFunctionData,
|
|
15
16
|
encodeAbiParameters,
|
|
16
17
|
encodeFunctionData,
|
|
17
18
|
encodePacked,
|
|
@@ -266,6 +267,35 @@ export async function toBiconomySmartAccount(
|
|
|
266
267
|
args: [call.to, call.value ?? 0n, call.data ?? "0x"]
|
|
267
268
|
})
|
|
268
269
|
},
|
|
270
|
+
decodeCalls: async (data) => {
|
|
271
|
+
const decoded = decodeFunctionData({
|
|
272
|
+
abi: BiconomyAbi,
|
|
273
|
+
data
|
|
274
|
+
})
|
|
275
|
+
if (decoded.functionName === "execute_ncC") {
|
|
276
|
+
return [
|
|
277
|
+
{
|
|
278
|
+
to: decoded.args[0],
|
|
279
|
+
value: decoded.args[1],
|
|
280
|
+
data: decoded.args[2]
|
|
281
|
+
}
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
if (decoded.functionName === "executeBatch_y6U") {
|
|
285
|
+
const calls: { to: Address; value: bigint; data: Hex }[] = []
|
|
286
|
+
|
|
287
|
+
for (let i = 0; i < decoded.args[0].length; i++) {
|
|
288
|
+
calls.push({
|
|
289
|
+
to: decoded.args[0][i],
|
|
290
|
+
value: decoded.args[1][i],
|
|
291
|
+
data: decoded.args[2][i]
|
|
292
|
+
})
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return calls
|
|
296
|
+
}
|
|
297
|
+
throw new Error("Invalid function name")
|
|
298
|
+
},
|
|
269
299
|
// Get simple dummy signature for ECDSA module authorization
|
|
270
300
|
async getStubSignature() {
|
|
271
301
|
const dynamicPart = ecdsaModuleAddress.substring(2).padEnd(40, "0")
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import {
|
|
2
|
+
decodeFunctionData,
|
|
3
|
+
encodeFunctionData,
|
|
4
|
+
erc20Abi,
|
|
5
|
+
zeroAddress
|
|
6
|
+
} from "viem"
|
|
7
|
+
import { describe, expect } from "vitest"
|
|
8
|
+
import { testWithRpc } from "../../permissionless-test/src/testWithRpc"
|
|
9
|
+
import { getCoreSmartAccounts } from "../../permissionless-test/src/utils"
|
|
10
|
+
|
|
11
|
+
describe.each(getCoreSmartAccounts())(
|
|
12
|
+
"decodeCalls $name",
|
|
13
|
+
({ getSmartAccountClient, name }) => {
|
|
14
|
+
testWithRpc(
|
|
15
|
+
"decodeCalls v0.6 single call with no data",
|
|
16
|
+
async ({ rpc }) => {
|
|
17
|
+
try {
|
|
18
|
+
const smartClient = await getSmartAccountClient({
|
|
19
|
+
entryPoint: {
|
|
20
|
+
version: "0.6"
|
|
21
|
+
},
|
|
22
|
+
...rpc
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const callData = await smartClient.account.encodeCalls([
|
|
26
|
+
{
|
|
27
|
+
to: zeroAddress,
|
|
28
|
+
data: "0x",
|
|
29
|
+
value: 0n
|
|
30
|
+
}
|
|
31
|
+
])
|
|
32
|
+
|
|
33
|
+
if (!smartClient.account.decodeCalls) {
|
|
34
|
+
throw new Error("decodeCalls is not supported")
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const decoded =
|
|
38
|
+
await smartClient.account.decodeCalls(callData)
|
|
39
|
+
|
|
40
|
+
expect(decoded).toEqual([
|
|
41
|
+
{ to: zeroAddress, data: "0x", value: 0n }
|
|
42
|
+
])
|
|
43
|
+
} catch (e) {
|
|
44
|
+
if (
|
|
45
|
+
e instanceof Error &&
|
|
46
|
+
e.message === "Kernel ERC7579 is not supported for V06"
|
|
47
|
+
) {
|
|
48
|
+
return // Expected error for ERC7579 accounts with v0.6
|
|
49
|
+
}
|
|
50
|
+
throw e
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
testWithRpc(
|
|
56
|
+
"decodeCalls v0.6 single call with data",
|
|
57
|
+
async ({ rpc }) => {
|
|
58
|
+
try {
|
|
59
|
+
const smartClient = await getSmartAccountClient({
|
|
60
|
+
entryPoint: {
|
|
61
|
+
version: "0.6"
|
|
62
|
+
},
|
|
63
|
+
...rpc
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
const erc20TransactionData = encodeFunctionData({
|
|
67
|
+
abi: erc20Abi,
|
|
68
|
+
functionName: "transfer",
|
|
69
|
+
args: [zeroAddress, 1000000000000000000n]
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
const callData = await smartClient.account.encodeCalls([
|
|
73
|
+
{
|
|
74
|
+
to: zeroAddress,
|
|
75
|
+
data: erc20TransactionData,
|
|
76
|
+
value: 0n
|
|
77
|
+
}
|
|
78
|
+
])
|
|
79
|
+
|
|
80
|
+
if (!smartClient.account.decodeCalls) {
|
|
81
|
+
throw new Error("decodeCalls is not supported")
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const decoded =
|
|
85
|
+
await smartClient.account.decodeCalls(callData)
|
|
86
|
+
|
|
87
|
+
expect(decoded).toEqual([
|
|
88
|
+
{
|
|
89
|
+
to: zeroAddress,
|
|
90
|
+
data: erc20TransactionData,
|
|
91
|
+
value: 0n
|
|
92
|
+
}
|
|
93
|
+
])
|
|
94
|
+
|
|
95
|
+
const decodeErc20TransactionData = decodeFunctionData({
|
|
96
|
+
abi: erc20Abi,
|
|
97
|
+
data: erc20TransactionData
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
expect(decodeErc20TransactionData.args).toEqual([
|
|
101
|
+
zeroAddress,
|
|
102
|
+
1000000000000000000n
|
|
103
|
+
])
|
|
104
|
+
} catch (e) {
|
|
105
|
+
if (
|
|
106
|
+
e instanceof Error &&
|
|
107
|
+
e.message === "Kernel ERC7579 is not supported for V06"
|
|
108
|
+
) {
|
|
109
|
+
return // Expected error for ERC7579 accounts with v0.6
|
|
110
|
+
}
|
|
111
|
+
throw e
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
testWithRpc("decodeCalls v0.6 multiple calls", async ({ rpc }) => {
|
|
117
|
+
try {
|
|
118
|
+
const smartClient = await getSmartAccountClient({
|
|
119
|
+
entryPoint: {
|
|
120
|
+
version: "0.6"
|
|
121
|
+
},
|
|
122
|
+
...rpc
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
const erc20TransactionData = encodeFunctionData({
|
|
126
|
+
abi: erc20Abi,
|
|
127
|
+
functionName: "transfer",
|
|
128
|
+
args: [zeroAddress, 1000000000000000000n]
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
const callData = await smartClient.account.encodeCalls([
|
|
132
|
+
{
|
|
133
|
+
to: zeroAddress,
|
|
134
|
+
data: "0x",
|
|
135
|
+
value: 0n
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
to: zeroAddress,
|
|
139
|
+
data: erc20TransactionData,
|
|
140
|
+
value: 10n
|
|
141
|
+
}
|
|
142
|
+
])
|
|
143
|
+
|
|
144
|
+
if (!smartClient.account.decodeCalls) {
|
|
145
|
+
throw new Error("decodeCalls is not supported")
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const decoded = await smartClient.account.decodeCalls(callData)
|
|
149
|
+
|
|
150
|
+
expect(decoded).toEqual([
|
|
151
|
+
{ to: zeroAddress, data: "0x", value: 0n },
|
|
152
|
+
{
|
|
153
|
+
to: zeroAddress,
|
|
154
|
+
data: erc20TransactionData,
|
|
155
|
+
value: name === "Simple" ? 0n : 10n
|
|
156
|
+
}
|
|
157
|
+
])
|
|
158
|
+
|
|
159
|
+
const decodeErc20TransactionData = decodeFunctionData({
|
|
160
|
+
abi: erc20Abi,
|
|
161
|
+
data: erc20TransactionData
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
expect(decodeErc20TransactionData.args).toEqual([
|
|
165
|
+
zeroAddress,
|
|
166
|
+
1000000000000000000n
|
|
167
|
+
])
|
|
168
|
+
} catch (e) {
|
|
169
|
+
if (
|
|
170
|
+
e instanceof Error &&
|
|
171
|
+
e.message === "Kernel ERC7579 is not supported for V06"
|
|
172
|
+
) {
|
|
173
|
+
return // Expected error for ERC7579 accounts with v0.6
|
|
174
|
+
}
|
|
175
|
+
throw e
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
testWithRpc(
|
|
180
|
+
"decodeCalls v0.7 single call with no data",
|
|
181
|
+
async ({ rpc }) => {
|
|
182
|
+
try {
|
|
183
|
+
const smartClient = await getSmartAccountClient({
|
|
184
|
+
entryPoint: {
|
|
185
|
+
version: "0.7"
|
|
186
|
+
},
|
|
187
|
+
...rpc
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
const callData = await smartClient.account.encodeCalls([
|
|
191
|
+
{
|
|
192
|
+
to: zeroAddress,
|
|
193
|
+
data: "0x",
|
|
194
|
+
value: 0n
|
|
195
|
+
}
|
|
196
|
+
])
|
|
197
|
+
|
|
198
|
+
if (!smartClient.account.decodeCalls) {
|
|
199
|
+
throw new Error("decodeCalls is not supported")
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const decoded =
|
|
203
|
+
await smartClient.account.decodeCalls(callData)
|
|
204
|
+
|
|
205
|
+
expect(decoded).toEqual([
|
|
206
|
+
{ to: zeroAddress, data: "0x", value: 0n }
|
|
207
|
+
])
|
|
208
|
+
} catch (e) {
|
|
209
|
+
if (
|
|
210
|
+
e instanceof Error &&
|
|
211
|
+
e.message === "Kernel ERC7579 is not supported for V06"
|
|
212
|
+
) {
|
|
213
|
+
return // Expected error for ERC7579 accounts with v0.6
|
|
214
|
+
}
|
|
215
|
+
throw e
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
testWithRpc(
|
|
221
|
+
"decodeCalls v0.7 single call with data",
|
|
222
|
+
async ({ rpc }) => {
|
|
223
|
+
try {
|
|
224
|
+
const smartClient = await getSmartAccountClient({
|
|
225
|
+
entryPoint: {
|
|
226
|
+
version: "0.7"
|
|
227
|
+
},
|
|
228
|
+
...rpc
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
const erc20TransactionData = encodeFunctionData({
|
|
232
|
+
abi: erc20Abi,
|
|
233
|
+
functionName: "transfer",
|
|
234
|
+
args: [zeroAddress, 1000000000000000000n]
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
const callData = await smartClient.account.encodeCalls([
|
|
238
|
+
{
|
|
239
|
+
to: zeroAddress,
|
|
240
|
+
data: erc20TransactionData,
|
|
241
|
+
value: 0n
|
|
242
|
+
}
|
|
243
|
+
])
|
|
244
|
+
|
|
245
|
+
if (!smartClient.account.decodeCalls) {
|
|
246
|
+
throw new Error("decodeCalls is not supported")
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const decoded =
|
|
250
|
+
await smartClient.account.decodeCalls(callData)
|
|
251
|
+
|
|
252
|
+
expect(decoded).toEqual([
|
|
253
|
+
{
|
|
254
|
+
to: zeroAddress,
|
|
255
|
+
data: erc20TransactionData,
|
|
256
|
+
value: 0n
|
|
257
|
+
}
|
|
258
|
+
])
|
|
259
|
+
|
|
260
|
+
const decodeErc20TransactionData = decodeFunctionData({
|
|
261
|
+
abi: erc20Abi,
|
|
262
|
+
data: erc20TransactionData
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
expect(decodeErc20TransactionData.args).toEqual([
|
|
266
|
+
zeroAddress,
|
|
267
|
+
1000000000000000000n
|
|
268
|
+
])
|
|
269
|
+
} catch (e) {
|
|
270
|
+
if (
|
|
271
|
+
e instanceof Error &&
|
|
272
|
+
e.message === "Kernel ERC7579 is not supported for V06"
|
|
273
|
+
) {
|
|
274
|
+
return // Expected error for ERC7579 accounts with v0.6
|
|
275
|
+
}
|
|
276
|
+
throw e
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
testWithRpc("decodeCalls v0.7 multiple calls", async ({ rpc }) => {
|
|
282
|
+
try {
|
|
283
|
+
const smartClient = await getSmartAccountClient({
|
|
284
|
+
entryPoint: {
|
|
285
|
+
version: "0.7"
|
|
286
|
+
},
|
|
287
|
+
...rpc
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
const erc20TransactionData = encodeFunctionData({
|
|
291
|
+
abi: erc20Abi,
|
|
292
|
+
functionName: "transfer",
|
|
293
|
+
args: [zeroAddress, 1000000000000000000n]
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
const callData = await smartClient.account.encodeCalls([
|
|
297
|
+
{
|
|
298
|
+
to: zeroAddress,
|
|
299
|
+
data: "0x",
|
|
300
|
+
value: 0n
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
to: zeroAddress,
|
|
304
|
+
data: erc20TransactionData,
|
|
305
|
+
value: 10n
|
|
306
|
+
}
|
|
307
|
+
])
|
|
308
|
+
|
|
309
|
+
if (!smartClient.account.decodeCalls) {
|
|
310
|
+
throw new Error("decodeCalls is not supported")
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const decoded = await smartClient.account.decodeCalls(callData)
|
|
314
|
+
|
|
315
|
+
expect(decoded).toEqual([
|
|
316
|
+
{ to: zeroAddress, data: "0x", value: 0n },
|
|
317
|
+
{ to: zeroAddress, data: erc20TransactionData, value: 10n }
|
|
318
|
+
])
|
|
319
|
+
|
|
320
|
+
const decodeErc20TransactionData = decodeFunctionData({
|
|
321
|
+
abi: erc20Abi,
|
|
322
|
+
data: erc20TransactionData
|
|
323
|
+
})
|
|
324
|
+
|
|
325
|
+
expect(decodeErc20TransactionData.args).toEqual([
|
|
326
|
+
zeroAddress,
|
|
327
|
+
1000000000000000000n
|
|
328
|
+
])
|
|
329
|
+
} catch (e) {
|
|
330
|
+
if (
|
|
331
|
+
e instanceof Error &&
|
|
332
|
+
e.message === "Kernel ERC7579 is not supported for V06"
|
|
333
|
+
) {
|
|
334
|
+
return // Expected error for ERC7579 accounts with v0.6
|
|
335
|
+
}
|
|
336
|
+
throw e
|
|
337
|
+
}
|
|
338
|
+
})
|
|
339
|
+
}
|
|
340
|
+
)
|
|
@@ -29,6 +29,7 @@ import { getChainId } from "viem/actions"
|
|
|
29
29
|
import { getAction } from "viem/utils"
|
|
30
30
|
import { getAccountNonce } from "../../actions/public/getAccountNonce.js"
|
|
31
31
|
import { getSenderAddress } from "../../actions/public/getSenderAddress.js"
|
|
32
|
+
import { decode7579Calls } from "../../utils/decode7579Calls.js"
|
|
32
33
|
import { encode7579Calls } from "../../utils/encode7579Calls.js"
|
|
33
34
|
import { toOwner } from "../../utils/index.js"
|
|
34
35
|
import {
|
|
@@ -283,6 +284,9 @@ export async function toEtherspotSmartAccount<entryPointVersion extends "0.7">(
|
|
|
283
284
|
callData: calls
|
|
284
285
|
})
|
|
285
286
|
},
|
|
287
|
+
async decodeCalls(callData) {
|
|
288
|
+
return decode7579Calls(callData).callData
|
|
289
|
+
},
|
|
286
290
|
async getNonce(_args) {
|
|
287
291
|
return getAccountNonce(client, {
|
|
288
292
|
address: await this.getAddress(),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const KernelV3FactoryAbi = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "createAccount",
|
|
5
|
+
inputs: [
|
|
6
|
+
{ name: "data", type: "bytes", internalType: "bytes" },
|
|
7
|
+
{ name: "salt", type: "bytes32", internalType: "bytes32" }
|
|
8
|
+
],
|
|
9
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
10
|
+
stateMutability: "payable"
|
|
11
|
+
}
|
|
12
|
+
] as const
|
|
@@ -41,12 +41,14 @@ import {
|
|
|
41
41
|
KernelV3InitAbi,
|
|
42
42
|
KernelV3_1AccountAbi
|
|
43
43
|
} from "./abi/KernelV3AccountAbi.js"
|
|
44
|
+
import { KernelV3FactoryAbi } from "./abi/KernelV3FactoryAbi.js"
|
|
44
45
|
import { KernelV3MetaFactoryDeployWithFactoryAbi } from "./abi/KernelV3MetaFactoryAbi.js"
|
|
45
46
|
import {
|
|
46
47
|
DUMMY_ECDSA_SIGNATURE,
|
|
47
48
|
ROOT_MODE_KERNEL_V2,
|
|
48
49
|
VALIDATOR_TYPE
|
|
49
50
|
} from "./constants.js"
|
|
51
|
+
import { decodeCallData } from "./utils/decodeCallData.js"
|
|
50
52
|
import { encodeCallData } from "./utils/encodeCallData.js"
|
|
51
53
|
import { getNonceKeyWithEncoding } from "./utils/getNonceKey.js"
|
|
52
54
|
import { isKernelV2 } from "./utils/isKernelV2.js"
|
|
@@ -315,7 +317,8 @@ const getAccountInitCode = async <entryPointVersion extends "0.6" | "0.7">({
|
|
|
315
317
|
index,
|
|
316
318
|
factoryAddress,
|
|
317
319
|
accountLogicAddress,
|
|
318
|
-
validatorAddress
|
|
320
|
+
validatorAddress,
|
|
321
|
+
useMetaFactory
|
|
319
322
|
}: {
|
|
320
323
|
kernelVersion: KernelVersion<entryPointVersion>
|
|
321
324
|
entryPointVersion: entryPointVersion
|
|
@@ -324,6 +327,7 @@ const getAccountInitCode = async <entryPointVersion extends "0.6" | "0.7">({
|
|
|
324
327
|
factoryAddress: Address
|
|
325
328
|
accountLogicAddress: Address
|
|
326
329
|
validatorAddress: Address
|
|
330
|
+
useMetaFactory: boolean
|
|
327
331
|
}): Promise<Hex> => {
|
|
328
332
|
// Build the account initialization data
|
|
329
333
|
const initializationData = getInitializationData({
|
|
@@ -343,6 +347,14 @@ const getAccountInitCode = async <entryPointVersion extends "0.6" | "0.7">({
|
|
|
343
347
|
})
|
|
344
348
|
}
|
|
345
349
|
|
|
350
|
+
if (!useMetaFactory) {
|
|
351
|
+
return encodeFunctionData({
|
|
352
|
+
abi: KernelV3FactoryAbi,
|
|
353
|
+
functionName: "createAccount",
|
|
354
|
+
args: [initializationData, toHex(index, { size: 32 })]
|
|
355
|
+
})
|
|
356
|
+
}
|
|
357
|
+
|
|
346
358
|
return encodeFunctionData({
|
|
347
359
|
abi: KernelV3MetaFactoryDeployWithFactoryAbi,
|
|
348
360
|
functionName: "deployWithFactory",
|
|
@@ -374,6 +386,7 @@ export type ToKernelSmartAccountParameters<
|
|
|
374
386
|
accountLogicAddress?: Address
|
|
375
387
|
validatorAddress?: Address
|
|
376
388
|
nonceKey?: bigint
|
|
389
|
+
useMetaFactory?: boolean
|
|
377
390
|
}
|
|
378
391
|
|
|
379
392
|
export type KernelSmartAccountImplementation<
|
|
@@ -431,7 +444,8 @@ export async function toKernelSmartAccount<
|
|
|
431
444
|
validatorAddress: _validatorAddress,
|
|
432
445
|
factoryAddress: _factoryAddress,
|
|
433
446
|
metaFactoryAddress: _metaFactoryAddress,
|
|
434
|
-
accountLogicAddress: _accountLogicAddress
|
|
447
|
+
accountLogicAddress: _accountLogicAddress,
|
|
448
|
+
useMetaFactory = true
|
|
435
449
|
} = parameters
|
|
436
450
|
|
|
437
451
|
const isWebAuthn = owners[0].type === "webAuthn"
|
|
@@ -484,7 +498,8 @@ export async function toKernelSmartAccount<
|
|
|
484
498
|
index,
|
|
485
499
|
factoryAddress,
|
|
486
500
|
accountLogicAddress,
|
|
487
|
-
validatorAddress
|
|
501
|
+
validatorAddress,
|
|
502
|
+
useMetaFactory
|
|
488
503
|
})
|
|
489
504
|
|
|
490
505
|
let accountAddress: Address | undefined = address
|
|
@@ -502,7 +517,7 @@ export async function toKernelSmartAccount<
|
|
|
502
517
|
const getFactoryArgs = async () => {
|
|
503
518
|
return {
|
|
504
519
|
factory:
|
|
505
|
-
entryPoint.version === "0.6"
|
|
520
|
+
entryPoint.version === "0.6" || useMetaFactory === false
|
|
506
521
|
? factoryAddress
|
|
507
522
|
: metaFactoryAddress,
|
|
508
523
|
factoryData: await generateInitCode()
|
|
@@ -530,6 +545,9 @@ export async function toKernelSmartAccount<
|
|
|
530
545
|
async encodeCalls(calls) {
|
|
531
546
|
return encodeCallData({ calls, kernelVersion })
|
|
532
547
|
},
|
|
548
|
+
async decodeCalls(callData) {
|
|
549
|
+
return decodeCallData({ callData, kernelVersion })
|
|
550
|
+
},
|
|
533
551
|
async getNonce(_args) {
|
|
534
552
|
return getAccountNonce(client, {
|
|
535
553
|
address: await this.getAddress(),
|