@permissionless/wagmi 0.0.0 → 0.0.3

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/_cjs/connectors/biconomySmartAccount.js +18 -0
  3. package/_cjs/connectors/biconomySmartAccount.js.map +1 -0
  4. package/_cjs/connectors/kernelSmartAccount.js +18 -0
  5. package/_cjs/connectors/kernelSmartAccount.js.map +1 -0
  6. package/_cjs/connectors/safeSmartAccount.js +18 -0
  7. package/_cjs/connectors/safeSmartAccount.js.map +1 -0
  8. package/_cjs/connectors/simpleSmartAccount.js +30 -0
  9. package/_cjs/connectors/simpleSmartAccount.js.map +1 -0
  10. package/_cjs/connectors/smartAccount.js +51 -0
  11. package/_cjs/connectors/smartAccount.js.map +1 -0
  12. package/_cjs/index.js +14 -0
  13. package/_cjs/index.js.map +1 -0
  14. package/_cjs/package.json +1 -0
  15. package/_esm/connectors/biconomySmartAccount.js +14 -0
  16. package/_esm/connectors/biconomySmartAccount.js.map +1 -0
  17. package/_esm/connectors/kernelSmartAccount.js +14 -0
  18. package/_esm/connectors/kernelSmartAccount.js.map +1 -0
  19. package/_esm/connectors/safeSmartAccount.js +14 -0
  20. package/_esm/connectors/safeSmartAccount.js.map +1 -0
  21. package/_esm/connectors/simpleSmartAccount.js +26 -0
  22. package/_esm/connectors/simpleSmartAccount.js.map +1 -0
  23. package/_esm/connectors/smartAccount.js +53 -0
  24. package/_esm/connectors/smartAccount.js.map +1 -0
  25. package/_esm/index.js +7 -0
  26. package/_esm/index.js.map +1 -0
  27. package/_esm/package.json +1 -0
  28. package/_types/connectors/biconomySmartAccount.d.ts +317 -0
  29. package/_types/connectors/biconomySmartAccount.d.ts.map +1 -0
  30. package/_types/connectors/kernelSmartAccount.d.ts +317 -0
  31. package/_types/connectors/kernelSmartAccount.d.ts.map +1 -0
  32. package/_types/connectors/safeSmartAccount.d.ts +317 -0
  33. package/_types/connectors/safeSmartAccount.d.ts.map +1 -0
  34. package/_types/connectors/simpleSmartAccount.d.ts +635 -0
  35. package/_types/connectors/simpleSmartAccount.d.ts.map +1 -0
  36. package/_types/connectors/smartAccount.d.ts +294 -0
  37. package/_types/connectors/smartAccount.d.ts.map +1 -0
  38. package/_types/index.d.ts +7 -0
  39. package/_types/index.d.ts.map +1 -0
  40. package/connectors/biconomySmartAccount.ts +53 -0
  41. package/connectors/kernelSmartAccount.ts +53 -0
  42. package/connectors/safeSmartAccount.ts +50 -0
  43. package/connectors/simpleSmartAccount.ts +90 -0
  44. package/index.ts +30 -1
  45. package/package.json +31 -41
package/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # @permissionless/wagmi
2
+
3
+ ## 0.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 17ba362046c66642e908b7f8af0d0b4b4ef16de1: Added account-specific connectors
8
+ - Updated dependencies [17ba362046c66642e908b7f8af0d0b4b4ef16de1]
9
+ - permissionless@0.0.35
10
+
11
+ ## 0.0.1
12
+
13
+ ### Patch Changes
14
+
15
+ - b9d43c1ec94f4a8235f5167612870f02666c8c4e: First release with smartAccount connector
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.biconomySmartAccount = void 0;
4
+ const accounts_1 = require("permissionless/accounts");
5
+ const simpleSmartAccount_1 = require("./simpleSmartAccount.js");
6
+ async function biconomySmartAccount({ publicClient, signer, bundlerTransport, sponsorUserOperation, ...rest }) {
7
+ return (0, simpleSmartAccount_1.smartAccountConnectorHelper)({
8
+ account: await (0, accounts_1.signerToBiconomySmartAccount)(publicClient, {
9
+ ...rest,
10
+ signer
11
+ }),
12
+ publicClient,
13
+ bundlerTransport,
14
+ sponsorUserOperation
15
+ });
16
+ }
17
+ exports.biconomySmartAccount = biconomySmartAccount;
18
+ //# sourceMappingURL=biconomySmartAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"biconomySmartAccount.js","sourceRoot":"","sources":["../../connectors/biconomySmartAccount.ts"],"names":[],"mappings":";;;AAAA,sDAGgC;AAGhC,6DAG6B;AAoBtB,KAAK,UAAU,oBAAoB,CAKxC,EACE,YAAY,EACZ,MAAM,EACN,gBAAgB,EAChB,oBAAoB,EACpB,GAAG,IAAI,EAGV;IACG,OAAO,IAAA,gDAA2B,EAAC;QAC/B,OAAO,EAAE,MAAM,IAAA,uCAA4B,EAAC,YAAY,EAAE;YACtD,GAAG,IAAI;YACP,MAAM;SACT,CAAC;QACF,YAAY;QACZ,gBAAgB;QAChB,oBAAoB;KACvB,CAAC,CAAA;AACN,CAAC;AAvBD,oDAuBC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.kernelSmartAccount = void 0;
4
+ const accounts_1 = require("permissionless/accounts");
5
+ const simpleSmartAccount_1 = require("./simpleSmartAccount.js");
6
+ async function kernelSmartAccount({ publicClient, signer, bundlerTransport, sponsorUserOperation, ...rest }) {
7
+ return (0, simpleSmartAccount_1.smartAccountConnectorHelper)({
8
+ account: await (0, accounts_1.signerToEcdsaKernelSmartAccount)(publicClient, {
9
+ ...rest,
10
+ signer
11
+ }),
12
+ publicClient,
13
+ bundlerTransport,
14
+ sponsorUserOperation
15
+ });
16
+ }
17
+ exports.kernelSmartAccount = kernelSmartAccount;
18
+ //# sourceMappingURL=kernelSmartAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernelSmartAccount.js","sourceRoot":"","sources":["../../connectors/kernelSmartAccount.ts"],"names":[],"mappings":";;;AAAA,sDAGgC;AAGhC,6DAG6B;AAoBtB,KAAK,UAAU,kBAAkB,CAKtC,EACE,YAAY,EACZ,MAAM,EACN,gBAAgB,EAChB,oBAAoB,EACpB,GAAG,IAAI,EAGV;IACG,OAAO,IAAA,gDAA2B,EAAC;QAC/B,OAAO,EAAE,MAAM,IAAA,0CAA+B,EAAC,YAAY,EAAE;YACzD,GAAG,IAAI;YACP,MAAM;SACT,CAAC;QACF,YAAY;QACZ,gBAAgB;QAChB,oBAAoB;KACvB,CAAC,CAAA;AACN,CAAC;AAvBD,gDAuBC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.safeSmartAccount = void 0;
4
+ const accounts_1 = require("permissionless/accounts");
5
+ const simpleSmartAccount_1 = require("./simpleSmartAccount.js");
6
+ async function safeSmartAccount({ publicClient, signer, bundlerTransport, sponsorUserOperation, ...rest }) {
7
+ return (0, simpleSmartAccount_1.smartAccountConnectorHelper)({
8
+ account: await (0, accounts_1.signerToSafeSmartAccount)(publicClient, {
9
+ ...rest,
10
+ signer
11
+ }),
12
+ publicClient,
13
+ bundlerTransport,
14
+ sponsorUserOperation
15
+ });
16
+ }
17
+ exports.safeSmartAccount = safeSmartAccount;
18
+ //# sourceMappingURL=safeSmartAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safeSmartAccount.js","sourceRoot":"","sources":["../../connectors/safeSmartAccount.ts"],"names":[],"mappings":";;;AAAA,sDAGgC;AAGhC,6DAG6B;AAiBtB,KAAK,UAAU,gBAAgB,CAKpC,EACE,YAAY,EACZ,MAAM,EACN,gBAAgB,EAChB,oBAAoB,EACpB,GAAG,IAAI,EAGV;IACG,OAAO,IAAA,gDAA2B,EAAC;QAC/B,OAAO,EAAE,MAAM,IAAA,mCAAwB,EAAC,YAAY,EAAE;YAClD,GAAG,IAAI;YACP,MAAM;SACT,CAAC;QACF,YAAY;QACZ,gBAAgB;QAChB,oBAAoB;KACvB,CAAC,CAAA;AACN,CAAC;AAvBD,4CAuBC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.simpleSmartAccount = exports.smartAccountConnectorHelper = void 0;
4
+ const permissionless_1 = require("permissionless");
5
+ const accounts_1 = require("permissionless/accounts");
6
+ const smartAccount_1 = require("./smartAccount.js");
7
+ async function smartAccountConnectorHelper({ bundlerTransport, sponsorUserOperation, account }) {
8
+ const smartAccountClient = (0, permissionless_1.createSmartAccountClient)({
9
+ account,
10
+ transport: bundlerTransport,
11
+ sponsorUserOperation: sponsorUserOperation
12
+ });
13
+ return (0, smartAccount_1.smartAccount)({
14
+ smartAccountClient: smartAccountClient
15
+ });
16
+ }
17
+ exports.smartAccountConnectorHelper = smartAccountConnectorHelper;
18
+ async function simpleSmartAccount({ publicClient, signer, bundlerTransport, sponsorUserOperation, ...rest }) {
19
+ return smartAccountConnectorHelper({
20
+ account: await (0, accounts_1.signerToSimpleSmartAccount)(publicClient, {
21
+ ...rest,
22
+ signer
23
+ }),
24
+ publicClient,
25
+ bundlerTransport,
26
+ sponsorUserOperation
27
+ });
28
+ }
29
+ exports.simpleSmartAccount = simpleSmartAccount;
30
+ //# sourceMappingURL=simpleSmartAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simpleSmartAccount.js","sourceRoot":"","sources":["../../connectors/simpleSmartAccount.ts"],"names":[],"mappings":";;;AAAA,mDAAyD;AACzD,sDAKgC;AAIhC,iDAA6C;AA8BtC,KAAK,UAAU,2BAA2B,CAO/C,EACE,gBAAgB,EAChB,oBAAoB,EACpB,OAAO,EAMV;IACG,MAAM,kBAAkB,GAAG,IAAA,yCAAwB,EAAC;QAChD,OAAO;QACP,SAAS,EAAE,gBAAgB;QAC3B,oBAAoB,EAAE,oBAAoB;KAC7C,CAAC,CAAA;IAEF,OAAO,IAAA,2BAAY,EAAC;QAChB,kBAAkB,EAAE,kBAAkB;KACzC,CAAC,CAAA;AACN,CAAC;AA1BD,kEA0BC;AAEM,KAAK,UAAU,kBAAkB,CAKtC,EACE,YAAY,EACZ,MAAM,EACN,gBAAgB,EAChB,oBAAoB,EACpB,GAAG,IAAI,EAC2D;IAClE,OAAO,2BAA2B,CAAC;QAC/B,OAAO,EAAE,MAAM,IAAA,qCAA0B,EAAC,YAAY,EAAE;YACpD,GAAG,IAAI;YACP,MAAM;SACT,CAAC;QACF,YAAY;QACZ,gBAAgB;QAChB,oBAAoB;KACvB,CAAC,CAAA;AACN,CAAC;AArBD,gDAqBC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.smartAccount = void 0;
4
+ const permissionless_1 = require("permissionless");
5
+ const wagmi_1 = require("wagmi");
6
+ function smartAccount({ smartAccountClient, id = smartAccountClient.uid, name = smartAccountClient.name, type = "smart-account" }) {
7
+ smartAccountClient.estimateGas = () => {
8
+ return undefined;
9
+ };
10
+ return (0, wagmi_1.createConnector)((config) => ({
11
+ id,
12
+ name,
13
+ type,
14
+ async connect({ chainId } = {}) {
15
+ if (chainId && chainId !== (await this.getChainId())) {
16
+ throw new Error(`Invalid chainId ${chainId} requested`);
17
+ }
18
+ return {
19
+ accounts: [smartAccountClient.account.address],
20
+ chainId: await this.getChainId()
21
+ };
22
+ },
23
+ async disconnect() { },
24
+ async getAccounts() {
25
+ return [smartAccountClient.account.address];
26
+ },
27
+ getChainId() {
28
+ return (0, permissionless_1.chainId)(smartAccountClient);
29
+ },
30
+ async getProvider() { },
31
+ async isAuthorized() {
32
+ return !!smartAccountClient.account.address;
33
+ },
34
+ onAccountsChanged() {
35
+ },
36
+ onChainChanged() {
37
+ },
38
+ onDisconnect() {
39
+ config.emitter.emit("disconnect");
40
+ },
41
+ async getClient({ chainId: requestedChainId }) {
42
+ const chainId = await this.getChainId();
43
+ if (requestedChainId !== chainId) {
44
+ throw new Error(`Invalid chainId ${chainId} requested`);
45
+ }
46
+ return smartAccountClient;
47
+ }
48
+ }));
49
+ }
50
+ exports.smartAccount = smartAccount;
51
+ //# sourceMappingURL=smartAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smartAccount.js","sourceRoot":"","sources":["../../connectors/smartAccount.ts"],"names":[],"mappings":";;;AAAA,mDAAiE;AAGjE,iCAAuC;AAEvC,SAAgB,YAAY,CAI1B,EACE,kBAAkB,EAClB,EAAE,GAAG,kBAAkB,CAAC,GAAG,EAC3B,IAAI,GAAG,kBAAkB,CAAC,IAAI,EAC9B,IAAI,GAAG,eAAe,EAQzB;IAGG,kBAAkB,CAAC,WAAW,GAAG,GAAG,EAAE;QAClC,OAAO,SAAS,CAAA;IACpB,CAAC,CAAA;IAED,OAAO,IAAA,uBAAe,EAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAChC,EAAE;QACF,IAAI;QACJ,IAAI;QAEJ,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE;YAC1B,IAAI,OAAO,IAAI,OAAO,KAAK,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;gBACnD,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,YAAY,CAAC,CAAA;YAC3D,CAAC;YAED,OAAO;gBACH,QAAQ,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC;gBAC9C,OAAO,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE;aACnC,CAAA;QACL,CAAC;QACD,KAAK,CAAC,UAAU,KAAI,CAAC;QACrB,KAAK,CAAC,WAAW;YACb,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC/C,CAAC;QACD,UAAU;YACN,OAAO,IAAA,wBAAO,EAAC,kBAAkB,CAAC,CAAA;QACtC,CAAC;QACD,KAAK,CAAC,WAAW,KAAI,CAAC;QACtB,KAAK,CAAC,YAAY;YACd,OAAO,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAA;QAC/C,CAAC;QACD,iBAAiB;QAEjB,CAAC;QACD,cAAc;QAEd,CAAC;QACD,YAAY;YACR,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QACrC,CAAC;QACD,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAuB;YAC9D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAA;YACvC,IAAI,gBAAgB,KAAK,OAAO,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,YAAY,CAAC,CAAA;YAC3D,CAAC;YACD,OAAO,kBAAkB,CAAA;QAC7B,CAAC;KACJ,CAAC,CAAC,CAAA;AACP,CAAC;AAlED,oCAkEC"}
package/_cjs/index.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.kernelSmartAccount = exports.biconomySmartAccount = exports.safeSmartAccount = exports.simpleSmartAccount = exports.smartAccount = void 0;
4
+ const simpleSmartAccount_1 = require("./connectors/simpleSmartAccount.js");
5
+ Object.defineProperty(exports, "simpleSmartAccount", { enumerable: true, get: function () { return simpleSmartAccount_1.simpleSmartAccount; } });
6
+ const smartAccount_1 = require("./connectors/smartAccount.js");
7
+ Object.defineProperty(exports, "smartAccount", { enumerable: true, get: function () { return smartAccount_1.smartAccount; } });
8
+ const safeSmartAccount_1 = require("./connectors/safeSmartAccount.js");
9
+ Object.defineProperty(exports, "safeSmartAccount", { enumerable: true, get: function () { return safeSmartAccount_1.safeSmartAccount; } });
10
+ const biconomySmartAccount_1 = require("./connectors/biconomySmartAccount.js");
11
+ Object.defineProperty(exports, "biconomySmartAccount", { enumerable: true, get: function () { return biconomySmartAccount_1.biconomySmartAccount; } });
12
+ const kernelSmartAccount_1 = require("./connectors/kernelSmartAccount.js");
13
+ Object.defineProperty(exports, "kernelSmartAccount", { enumerable: true, get: function () { return kernelSmartAccount_1.kernelSmartAccount; } });
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,wEAGwC;AAoBpC,mGArBA,uCAAkB,OAqBA;AAnBtB,4DAAwD;AAkBpD,6FAlBK,2BAAY,OAkBL;AAhBhB,oEAGsC;AAgBlC,iGAjBA,mCAAgB,OAiBA;AAdpB,4EAG0C;AAatC,qGAdA,2CAAoB,OAcA;AAXxB,wEAGwC;AAUpC,mGAXA,uCAAkB,OAWA"}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,14 @@
1
+ import { signerToBiconomySmartAccount } from "permissionless/accounts";
2
+ import { smartAccountConnectorHelper } from "./simpleSmartAccount.js";
3
+ export async function biconomySmartAccount({ publicClient, signer, bundlerTransport, sponsorUserOperation, ...rest }) {
4
+ return smartAccountConnectorHelper({
5
+ account: await signerToBiconomySmartAccount(publicClient, {
6
+ ...rest,
7
+ signer
8
+ }),
9
+ publicClient,
10
+ bundlerTransport,
11
+ sponsorUserOperation
12
+ });
13
+ }
14
+ //# sourceMappingURL=biconomySmartAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"biconomySmartAccount.js","sourceRoot":"","sources":["../../connectors/biconomySmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,4BAA4B,EAC/B,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EAEH,2BAA2B,EAC9B,MAAM,sBAAsB,CAAA;AAoB7B,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAKxC,EACE,YAAY,EACZ,MAAM,EACN,gBAAgB,EAChB,oBAAoB,EACpB,GAAG,IAAI,EAGV;IACG,OAAO,2BAA2B,CAAC;QAC/B,OAAO,EAAE,MAAM,4BAA4B,CAAC,YAAY,EAAE;YACtD,GAAG,IAAI;YACP,MAAM;SACT,CAAC;QACF,YAAY;QACZ,gBAAgB;QAChB,oBAAoB;KACvB,CAAC,CAAA;AACN,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { signerToEcdsaKernelSmartAccount } from "permissionless/accounts";
2
+ import { smartAccountConnectorHelper } from "./simpleSmartAccount.js";
3
+ export async function kernelSmartAccount({ publicClient, signer, bundlerTransport, sponsorUserOperation, ...rest }) {
4
+ return smartAccountConnectorHelper({
5
+ account: await signerToEcdsaKernelSmartAccount(publicClient, {
6
+ ...rest,
7
+ signer
8
+ }),
9
+ publicClient,
10
+ bundlerTransport,
11
+ sponsorUserOperation
12
+ });
13
+ }
14
+ //# sourceMappingURL=kernelSmartAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernelSmartAccount.js","sourceRoot":"","sources":["../../connectors/kernelSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,+BAA+B,EAClC,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EAEH,2BAA2B,EAC9B,MAAM,sBAAsB,CAAA;AAoB7B,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAKtC,EACE,YAAY,EACZ,MAAM,EACN,gBAAgB,EAChB,oBAAoB,EACpB,GAAG,IAAI,EAGV;IACG,OAAO,2BAA2B,CAAC;QAC/B,OAAO,EAAE,MAAM,+BAA+B,CAAC,YAAY,EAAE;YACzD,GAAG,IAAI;YACP,MAAM;SACT,CAAC;QACF,YAAY;QACZ,gBAAgB;QAChB,oBAAoB;KACvB,CAAC,CAAA;AACN,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { signerToSafeSmartAccount } from "permissionless/accounts";
2
+ import { smartAccountConnectorHelper } from "./simpleSmartAccount.js";
3
+ export async function safeSmartAccount({ publicClient, signer, bundlerTransport, sponsorUserOperation, ...rest }) {
4
+ return smartAccountConnectorHelper({
5
+ account: await signerToSafeSmartAccount(publicClient, {
6
+ ...rest,
7
+ signer
8
+ }),
9
+ publicClient,
10
+ bundlerTransport,
11
+ sponsorUserOperation
12
+ });
13
+ }
14
+ //# sourceMappingURL=safeSmartAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safeSmartAccount.js","sourceRoot":"","sources":["../../connectors/safeSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,wBAAwB,EAC3B,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EAEH,2BAA2B,EAC9B,MAAM,sBAAsB,CAAA;AAiB7B,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAKpC,EACE,YAAY,EACZ,MAAM,EACN,gBAAgB,EAChB,oBAAoB,EACpB,GAAG,IAAI,EAGV;IACG,OAAO,2BAA2B,CAAC;QAC/B,OAAO,EAAE,MAAM,wBAAwB,CAAC,YAAY,EAAE;YAClD,GAAG,IAAI;YACP,MAAM;SACT,CAAC;QACF,YAAY;QACZ,gBAAgB;QAChB,oBAAoB;KACvB,CAAC,CAAA;AACN,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { createSmartAccountClient } from "permissionless";
2
+ import { signerToSimpleSmartAccount } from "permissionless/accounts";
3
+ import {} from "permissionless/actions/smartAccount";
4
+ import { smartAccount } from "./smartAccount.js";
5
+ export async function smartAccountConnectorHelper({ bundlerTransport, sponsorUserOperation, account }) {
6
+ const smartAccountClient = createSmartAccountClient({
7
+ account,
8
+ transport: bundlerTransport,
9
+ sponsorUserOperation: sponsorUserOperation
10
+ });
11
+ return smartAccount({
12
+ smartAccountClient: smartAccountClient
13
+ });
14
+ }
15
+ export async function simpleSmartAccount({ publicClient, signer, bundlerTransport, sponsorUserOperation, ...rest }) {
16
+ return smartAccountConnectorHelper({
17
+ account: await signerToSimpleSmartAccount(publicClient, {
18
+ ...rest,
19
+ signer
20
+ }),
21
+ publicClient,
22
+ bundlerTransport,
23
+ sponsorUserOperation
24
+ });
25
+ }
26
+ //# sourceMappingURL=simpleSmartAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simpleSmartAccount.js","sourceRoot":"","sources":["../../connectors/simpleSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAIH,0BAA0B,EAC7B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAuC,MAAM,qCAAqC,CAAA;AAGzF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AA8B7C,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAO/C,EACE,gBAAgB,EAChB,oBAAoB,EACpB,OAAO,EAMV;IACG,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;QAChD,OAAO;QACP,SAAS,EAAE,gBAAgB;QAC3B,oBAAoB,EAAE,oBAAoB;KAC7C,CAAC,CAAA;IAEF,OAAO,YAAY,CAAC;QAChB,kBAAkB,EAAE,kBAAkB;KACzC,CAAC,CAAA;AACN,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAKtC,EACE,YAAY,EACZ,MAAM,EACN,gBAAgB,EAChB,oBAAoB,EACpB,GAAG,IAAI,EAC2D;IAClE,OAAO,2BAA2B,CAAC;QAC/B,OAAO,EAAE,MAAM,0BAA0B,CAAC,YAAY,EAAE;YACpD,GAAG,IAAI;YACP,MAAM;SACT,CAAC;QACF,YAAY;QACZ,gBAAgB;QAChB,oBAAoB;KACvB,CAAC,CAAA;AACN,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { chainId } from "permissionless";
2
+ import {} from "permissionless/accounts";
3
+ import { createConnector } from "wagmi";
4
+ export function smartAccount({ smartAccountClient, id = smartAccountClient.uid, name = smartAccountClient.name, type = "smart-account" }) {
5
+ // Don't remove this, it is needed because wagmi has an opinion on always estimating gas:
6
+ // https://github.com/wevm/wagmi/blob/main/packages/core/src/actions/sendTransaction.ts#L77
7
+ smartAccountClient.estimateGas = () => {
8
+ return undefined;
9
+ };
10
+ return createConnector((config) => ({
11
+ id,
12
+ name,
13
+ type,
14
+ // async setup() {},
15
+ async connect({ chainId } = {}) {
16
+ if (chainId && chainId !== (await this.getChainId())) {
17
+ throw new Error(`Invalid chainId ${chainId} requested`);
18
+ }
19
+ return {
20
+ accounts: [smartAccountClient.account.address],
21
+ chainId: await this.getChainId()
22
+ };
23
+ },
24
+ async disconnect() { },
25
+ async getAccounts() {
26
+ return [smartAccountClient.account.address];
27
+ },
28
+ getChainId() {
29
+ return chainId(smartAccountClient);
30
+ },
31
+ async getProvider() { },
32
+ async isAuthorized() {
33
+ return !!smartAccountClient.account.address;
34
+ },
35
+ onAccountsChanged() {
36
+ // Not relevant
37
+ },
38
+ onChainChanged() {
39
+ // Not relevant because smart accounts only exist on single chain.
40
+ },
41
+ onDisconnect() {
42
+ config.emitter.emit("disconnect");
43
+ },
44
+ async getClient({ chainId: requestedChainId }) {
45
+ const chainId = await this.getChainId();
46
+ if (requestedChainId !== chainId) {
47
+ throw new Error(`Invalid chainId ${chainId} requested`);
48
+ }
49
+ return smartAccountClient;
50
+ }
51
+ }));
52
+ }
53
+ //# sourceMappingURL=smartAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smartAccount.js","sourceRoot":"","sources":["../../connectors/smartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACjE,OAAO,EAAqB,MAAM,yBAAyB,CAAA;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAEvC,MAAM,UAAU,YAAY,CAI1B,EACE,kBAAkB,EAClB,EAAE,GAAG,kBAAkB,CAAC,GAAG,EAC3B,IAAI,GAAG,kBAAkB,CAAC,IAAI,EAC9B,IAAI,GAAG,eAAe,EAQzB;IACG,yFAAyF;IACzF,2FAA2F;IAC3F,kBAAkB,CAAC,WAAW,GAAG,GAAG,EAAE;QAClC,OAAO,SAAS,CAAA;IACpB,CAAC,CAAA;IAED,OAAO,eAAe,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAChC,EAAE;QACF,IAAI;QACJ,IAAI;QACJ,oBAAoB;QACpB,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE;YAC1B,IAAI,OAAO,IAAI,OAAO,KAAK,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;gBACnD,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,YAAY,CAAC,CAAA;YAC3D,CAAC;YAED,OAAO;gBACH,QAAQ,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC;gBAC9C,OAAO,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE;aACnC,CAAA;QACL,CAAC;QACD,KAAK,CAAC,UAAU,KAAI,CAAC;QACrB,KAAK,CAAC,WAAW;YACb,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC/C,CAAC;QACD,UAAU;YACN,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAA;QACtC,CAAC;QACD,KAAK,CAAC,WAAW,KAAI,CAAC;QACtB,KAAK,CAAC,YAAY;YACd,OAAO,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAA;QAC/C,CAAC;QACD,iBAAiB;YACb,eAAe;QACnB,CAAC;QACD,cAAc;YACV,kEAAkE;QACtE,CAAC;QACD,YAAY;YACR,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QACrC,CAAC;QACD,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAuB;YAC9D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAA;YACvC,IAAI,gBAAgB,KAAK,OAAO,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,YAAY,CAAC,CAAA;YAC3D,CAAC;YACD,OAAO,kBAAkB,CAAA;QAC7B,CAAC;KACJ,CAAC,CAAC,CAAA;AACP,CAAC"}
package/_esm/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import { simpleSmartAccount } from "./connectors/simpleSmartAccount.js";
2
+ import { smartAccount } from "./connectors/smartAccount.js";
3
+ import { safeSmartAccount } from "./connectors/safeSmartAccount.js";
4
+ import { biconomySmartAccount } from "./connectors/biconomySmartAccount.js";
5
+ import { kernelSmartAccount } from "./connectors/kernelSmartAccount.js";
6
+ export { smartAccount, simpleSmartAccount, safeSmartAccount, biconomySmartAccount, kernelSmartAccount };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,kBAAkB,EACrB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,EAEH,gBAAgB,EACnB,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EAEH,oBAAoB,EACvB,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EAEH,kBAAkB,EACrB,MAAM,iCAAiC,CAAA;AAExC,OAAO,EACH,YAAY,EACZ,kBAAkB,EAElB,gBAAgB,EAEhB,oBAAoB,EAEpB,kBAAkB,EAErB,CAAA"}
@@ -0,0 +1 @@
1
+ {"type": "module","sideEffects":false}