@account-kit/wallet-client 0.1.0-alpha.2 → 0.1.0-alpha.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 (110) hide show
  1. package/dist/esm/capabilities/index.d.ts +5 -2
  2. package/dist/esm/capabilities/index.js +1 -1
  3. package/dist/esm/capabilities/index.js.map +1 -1
  4. package/dist/esm/capabilities/overrides.js +8 -8
  5. package/dist/esm/capabilities/overrides.js.map +1 -1
  6. package/dist/esm/capabilities/permissions/index.d.ts +10 -3
  7. package/dist/esm/capabilities/permissions/index.js +11 -2
  8. package/dist/esm/capabilities/permissions/index.js.map +1 -1
  9. package/dist/esm/capabilities/permissions/mav2.d.ts +2 -2
  10. package/dist/esm/capabilities/permissions/mav2.js +9 -1
  11. package/dist/esm/capabilities/permissions/mav2.js.map +1 -1
  12. package/dist/esm/client/actions/grantPermissions.d.ts +57 -3
  13. package/dist/esm/client/actions/grantPermissions.js +1 -0
  14. package/dist/esm/client/actions/grantPermissions.js.map +1 -1
  15. package/dist/esm/client/actions/requestAccount.js +2 -2
  16. package/dist/esm/client/actions/requestAccount.js.map +1 -1
  17. package/dist/esm/client/actions/signSignatureRequest.d.ts +4 -1
  18. package/dist/esm/client/actions/signSignatureRequest.js +22 -1
  19. package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
  20. package/dist/esm/client/client.e2e-test.js +13 -19
  21. package/dist/esm/client/client.e2e-test.js.map +1 -1
  22. package/dist/esm/client/index.js +1 -1
  23. package/dist/esm/client/index.js.map +1 -1
  24. package/dist/esm/isomorphic/actions/createSession.js +25 -7
  25. package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
  26. package/dist/esm/isomorphic/actions/prepareCalls.js +35 -12
  27. package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
  28. package/dist/esm/isomorphic/actions/sendPreparedCalls.js +26 -6
  29. package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
  30. package/dist/esm/isomorphic/client.d.ts +11 -5
  31. package/dist/esm/isomorphic/utils/7702.d.ts +11 -0
  32. package/dist/esm/isomorphic/utils/7702.js +26 -0
  33. package/dist/esm/isomorphic/utils/7702.js.map +1 -0
  34. package/dist/esm/isomorphic/utils/createAccount.d.ts +2 -1
  35. package/dist/esm/isomorphic/utils/createAccount.js +30 -5
  36. package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
  37. package/dist/esm/isomorphic/utils/createDummySigner.js +3 -3
  38. package/dist/esm/isomorphic/utils/createDummySigner.js.map +1 -1
  39. package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +2 -1
  40. package/dist/esm/isomorphic/utils/parsePermissionsContext.js +17 -5
  41. package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +1 -1
  42. package/dist/esm/local/client.js +2 -1
  43. package/dist/esm/local/client.js.map +1 -1
  44. package/dist/esm/remote/client.js +6 -2
  45. package/dist/esm/remote/client.js.map +1 -1
  46. package/dist/esm/rpc/examples.d.ts +230 -0
  47. package/dist/esm/rpc/examples.js +314 -0
  48. package/dist/esm/rpc/examples.js.map +1 -0
  49. package/dist/esm/rpc/request.d.ts +48 -17
  50. package/dist/esm/rpc/request.js +53 -14
  51. package/dist/esm/rpc/request.js.map +1 -1
  52. package/dist/esm/rpc/schema.d.ts +42 -11
  53. package/dist/esm/schemas.d.ts +29 -7
  54. package/dist/esm/schemas.js +120 -38
  55. package/dist/esm/schemas.js.map +1 -1
  56. package/dist/types/capabilities/index.d.ts +5 -2
  57. package/dist/types/capabilities/index.d.ts.map +1 -1
  58. package/dist/types/capabilities/overrides.d.ts.map +1 -1
  59. package/dist/types/capabilities/permissions/index.d.ts +10 -3
  60. package/dist/types/capabilities/permissions/index.d.ts.map +1 -1
  61. package/dist/types/capabilities/permissions/mav2.d.ts +2 -2
  62. package/dist/types/capabilities/permissions/mav2.d.ts.map +1 -1
  63. package/dist/types/client/actions/grantPermissions.d.ts +57 -3
  64. package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
  65. package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
  66. package/dist/types/client/actions/signSignatureRequest.d.ts +4 -1
  67. package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
  68. package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
  69. package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
  70. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
  71. package/dist/types/isomorphic/client.d.ts +11 -5
  72. package/dist/types/isomorphic/client.d.ts.map +1 -1
  73. package/dist/types/isomorphic/utils/7702.d.ts +12 -0
  74. package/dist/types/isomorphic/utils/7702.d.ts.map +1 -0
  75. package/dist/types/isomorphic/utils/createAccount.d.ts +2 -1
  76. package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -1
  77. package/dist/types/isomorphic/utils/createDummySigner.d.ts.map +1 -1
  78. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +2 -1
  79. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +1 -1
  80. package/dist/types/remote/client.d.ts.map +1 -1
  81. package/dist/types/rpc/examples.d.ts +231 -0
  82. package/dist/types/rpc/examples.d.ts.map +1 -0
  83. package/dist/types/rpc/request.d.ts +48 -17
  84. package/dist/types/rpc/request.d.ts.map +1 -1
  85. package/dist/types/rpc/schema.d.ts +42 -11
  86. package/dist/types/rpc/schema.d.ts.map +1 -1
  87. package/dist/types/schemas.d.ts +29 -7
  88. package/dist/types/schemas.d.ts.map +1 -1
  89. package/package.json +2 -2
  90. package/src/capabilities/index.ts +5 -8
  91. package/src/capabilities/overrides.ts +23 -8
  92. package/src/capabilities/permissions/index.ts +21 -5
  93. package/src/capabilities/permissions/mav2.ts +12 -2
  94. package/src/client/actions/grantPermissions.ts +57 -3
  95. package/src/client/actions/requestAccount.ts +2 -3
  96. package/src/client/actions/signSignatureRequest.ts +31 -3
  97. package/src/client/client.e2e-test.ts +14 -21
  98. package/src/client/index.ts +1 -1
  99. package/src/isomorphic/actions/createSession.ts +28 -7
  100. package/src/isomorphic/actions/prepareCalls.ts +38 -11
  101. package/src/isomorphic/actions/sendPreparedCalls.ts +47 -20
  102. package/src/isomorphic/utils/7702.ts +58 -0
  103. package/src/isomorphic/utils/createAccount.ts +38 -6
  104. package/src/isomorphic/utils/createDummySigner.ts +3 -2
  105. package/src/isomorphic/utils/parsePermissionsContext.ts +23 -7
  106. package/src/local/client.ts +2 -3
  107. package/src/remote/client.ts +12 -2
  108. package/src/rpc/examples.ts +343 -0
  109. package/src/rpc/request.ts +75 -26
  110. package/src/schemas.ts +218 -87
@@ -1,6 +1,9 @@
1
1
  import { createModularAccountV2, } from "@account-kit/smart-contracts";
2
2
  import { concatHex, hexToNumber } from "viem";
3
3
  import { parsePermissionsContext } from "./parsePermissionsContext.js";
4
+ import { assertNever } from "../../utils.js";
5
+ import { getAccountTypeForImplementationAddress7702 } from "./7702.js";
6
+ import { InternalError } from "ox/RpcResponse";
4
7
  /**
5
8
  * Creates a smart account instance from the given parameters.
6
9
  * @param params - The parameters for creating a smart account.
@@ -8,22 +11,44 @@ import { parsePermissionsContext } from "./parsePermissionsContext.js";
8
11
  */
9
12
  export async function createAccount(params) {
10
13
  const { counterfactualInfo: ci, ...accountParams } = params;
11
- // TODO: Implement support for other account types.
12
- if (ci.factoryType !== "MAv2.0.0-sma-b") {
13
- throw new Error("Only MAv2 SMA-B accounts are currently supported");
14
+ const mode = params.delegation ? "7702" : "default";
15
+ if (mode === "default") {
16
+ if (!ci) {
17
+ throw new InternalError({
18
+ message: "Counterfactual info not found",
19
+ });
20
+ }
21
+ if (ci.factoryType !== "MAv2.0.0-sma-b") {
22
+ throw new InternalError({
23
+ message: `Factory type ${ci.factoryType} is not currently supported.`,
24
+ });
25
+ }
26
+ }
27
+ else if (mode === "7702") {
28
+ const accountType = getAccountTypeForImplementationAddress7702(params.delegation);
29
+ if (accountType !== "ModularAccountV2") {
30
+ throw new InternalError({
31
+ message: "7702 mode currently only supports ModularAccountV2",
32
+ });
33
+ }
34
+ }
35
+ else {
36
+ assertNever(mode, "Unexpected mode in createAccount");
14
37
  }
15
- const parsedContext = parsePermissionsContext(params.capabilities, ci);
38
+ const parsedContext = parsePermissionsContext(params.capabilities, ci, params.delegation);
16
39
  const signerEntity = parsedContext?.contextVersion === "NON_DEFERRED_ACTION"
17
40
  ? {
18
41
  entityId: hexToNumber(parsedContext.entityId),
19
42
  isGlobalValidation: parsedContext.isGlobalValidation,
20
43
  }
21
44
  : undefined;
45
+ // TODO: clean this up to support different account types.
22
46
  return createModularAccountV2({
23
47
  ...accountParams,
24
48
  signerEntity,
25
49
  deferredAction: parsedContext?.deferredAction,
26
- initCode: concatHex([ci.factoryAddress, ci.factoryData]),
50
+ initCode: ci ? concatHex([ci.factoryAddress, ci.factoryData]) : undefined,
51
+ mode,
27
52
  });
28
53
  }
29
54
  export function isModularAccountV2(account) {
@@ -1 +1 @@
1
- {"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createAccount.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,GAEvB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAG9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAWvE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA2B;IAE3B,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,CAAC;IAC5D,mDAAmD;IACnD,IAAI,EAAE,CAAC,WAAW,KAAK,gBAAgB,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,aAAa,GAAG,uBAAuB,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAEvE,MAAM,YAAY,GAChB,aAAa,EAAE,cAAc,KAAK,qBAAqB;QACrD,CAAC,CAAC;YACE,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC;YAC7C,kBAAkB,EAAE,aAAa,CAAC,kBAAkB;SACrD;QACH,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO,sBAAsB,CAAC;QAC5B,GAAG,aAAa;QAChB,YAAY;QACZ,cAAc,EAAE,aAAa,EAAE,cAAc;QAC7C,QAAQ,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC;KACzD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,OAA6B;IAE7B,OAAO,OAAO,CAAC,MAAM,KAAK,kBAAkB,CAAC;AAC/C,CAAC","sourcesContent":["import type { SmartAccountSigner, SmartContractAccount } from \"@aa-sdk/core\";\nimport {\n createModularAccountV2,\n type ModularAccountV2,\n} from \"@account-kit/smart-contracts\";\nimport type { StaticDecode } from \"@sinclair/typebox\";\nimport type { Address, Chain, Transport } from \"viem\";\nimport { concatHex, hexToNumber } from \"viem\";\nimport type { Capabilities } from \"../../capabilities/index.js\";\nimport type { TypeSerializedInitcode } from \"../../schemas.js\";\nimport { parsePermissionsContext } from \"./parsePermissionsContext.js\";\n\ntype CreateAccountParams = {\n chain: Chain;\n transport: Transport;\n signer: SmartAccountSigner;\n accountAddress: Address;\n counterfactualInfo: StaticDecode<typeof TypeSerializedInitcode>;\n capabilities?: StaticDecode<typeof Capabilities>;\n};\n\n/**\n * Creates a smart account instance from the given parameters.\n * @param params - The parameters for creating a smart account.\n * @returns A promise that resolves to the created smart account.\n */\nexport async function createAccount(\n params: CreateAccountParams,\n): Promise<SmartContractAccount> {\n const { counterfactualInfo: ci, ...accountParams } = params;\n // TODO: Implement support for other account types.\n if (ci.factoryType !== \"MAv2.0.0-sma-b\") {\n throw new Error(\"Only MAv2 SMA-B accounts are currently supported\");\n }\n\n const parsedContext = parsePermissionsContext(params.capabilities, ci);\n\n const signerEntity =\n parsedContext?.contextVersion === \"NON_DEFERRED_ACTION\"\n ? {\n entityId: hexToNumber(parsedContext.entityId),\n isGlobalValidation: parsedContext.isGlobalValidation,\n }\n : undefined;\n\n return createModularAccountV2({\n ...accountParams,\n signerEntity,\n deferredAction: parsedContext?.deferredAction,\n initCode: concatHex([ci.factoryAddress, ci.factoryData]),\n });\n}\n\nexport function isModularAccountV2(\n account: SmartContractAccount,\n): account is ModularAccountV2 {\n return account.source === \"ModularAccountV2\";\n}\n"]}
1
+ {"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createAccount.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,GAEvB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAG9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,0CAA0C,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAY/C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA2B;IAE3B,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,CAAC;IAE5D,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAEpD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,MAAM,IAAI,aAAa,CAAC;gBACtB,OAAO,EAAE,+BAA+B;aACzC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,EAAE,CAAC,WAAW,KAAK,gBAAgB,EAAE,CAAC;YACxC,MAAM,IAAI,aAAa,CAAC;gBACtB,OAAO,EAAE,gBAAgB,EAAE,CAAC,WAAW,8BAA8B;aACtE,CAAC,CAAC;QACL,CAAC;IACH,CAAC;SAAM,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QAC3B,MAAM,WAAW,GAAG,0CAA0C,CAC5D,MAAM,CAAC,UAAW,CACnB,CAAC;QACF,IAAI,WAAW,KAAK,kBAAkB,EAAE,CAAC;YACvC,MAAM,IAAI,aAAa,CAAC;gBACtB,OAAO,EAAE,oDAAoD;aAC9D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;SAAM,CAAC;QACN,WAAW,CAAC,IAAI,EAAE,kCAAkC,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,aAAa,GAAG,uBAAuB,CAC3C,MAAM,CAAC,YAAY,EACnB,EAAE,EACF,MAAM,CAAC,UAAU,CAClB,CAAC;IAEF,MAAM,YAAY,GAChB,aAAa,EAAE,cAAc,KAAK,qBAAqB;QACrD,CAAC,CAAC;YACE,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC;YAC7C,kBAAkB,EAAE,aAAa,CAAC,kBAAkB;SACrD;QACH,CAAC,CAAC,SAAS,CAAC;IAEhB,0DAA0D;IAC1D,OAAO,sBAAsB,CAAC;QAC5B,GAAG,aAAa;QAChB,YAAY;QACZ,cAAc,EAAE,aAAa,EAAE,cAAc;QAC7C,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;QACzE,IAAI;KACL,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,OAA6B;IAE7B,OAAO,OAAO,CAAC,MAAM,KAAK,kBAAkB,CAAC;AAC/C,CAAC","sourcesContent":["import type { SmartAccountSigner, SmartContractAccount } from \"@aa-sdk/core\";\nimport {\n createModularAccountV2,\n type ModularAccountV2,\n} from \"@account-kit/smart-contracts\";\nimport type { StaticDecode } from \"@sinclair/typebox\";\nimport type { Address, Chain, Transport } from \"viem\";\nimport { concatHex, hexToNumber } from \"viem\";\nimport type { Capabilities } from \"../../capabilities/index.js\";\nimport type { TypeSerializedInitcode } from \"../../schemas.js\";\nimport { parsePermissionsContext } from \"./parsePermissionsContext.js\";\nimport { assertNever } from \"../../utils.js\";\nimport { getAccountTypeForImplementationAddress7702 } from \"./7702.js\";\nimport { InternalError } from \"ox/RpcResponse\";\n\ntype CreateAccountParams = {\n chain: Chain;\n transport: Transport;\n signer: SmartAccountSigner;\n accountAddress: Address;\n counterfactualInfo?: StaticDecode<typeof TypeSerializedInitcode>; // undefined for 7702 accounts\n delegation?: Address;\n capabilities?: StaticDecode<typeof Capabilities>;\n};\n\n/**\n * Creates a smart account instance from the given parameters.\n * @param params - The parameters for creating a smart account.\n * @returns A promise that resolves to the created smart account.\n */\nexport async function createAccount(\n params: CreateAccountParams,\n): Promise<SmartContractAccount> {\n const { counterfactualInfo: ci, ...accountParams } = params;\n\n const mode = params.delegation ? \"7702\" : \"default\";\n\n if (mode === \"default\") {\n if (!ci) {\n throw new InternalError({\n message: \"Counterfactual info not found\",\n });\n }\n if (ci.factoryType !== \"MAv2.0.0-sma-b\") {\n throw new InternalError({\n message: `Factory type ${ci.factoryType} is not currently supported.`,\n });\n }\n } else if (mode === \"7702\") {\n const accountType = getAccountTypeForImplementationAddress7702(\n params.delegation!,\n );\n if (accountType !== \"ModularAccountV2\") {\n throw new InternalError({\n message: \"7702 mode currently only supports ModularAccountV2\",\n });\n }\n } else {\n assertNever(mode, \"Unexpected mode in createAccount\");\n }\n\n const parsedContext = parsePermissionsContext(\n params.capabilities,\n ci,\n params.delegation,\n );\n\n const signerEntity =\n parsedContext?.contextVersion === \"NON_DEFERRED_ACTION\"\n ? {\n entityId: hexToNumber(parsedContext.entityId),\n isGlobalValidation: parsedContext.isGlobalValidation,\n }\n : undefined;\n\n // TODO: clean this up to support different account types.\n return createModularAccountV2({\n ...accountParams,\n signerEntity,\n deferredAction: parsedContext?.deferredAction,\n initCode: ci ? concatHex([ci.factoryAddress, ci.factoryData]) : undefined,\n mode,\n });\n}\n\nexport function isModularAccountV2(\n account: SmartContractAccount,\n): account is ModularAccountV2 {\n return account.source === \"ModularAccountV2\";\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import {} from "@aa-sdk/core";
2
- import {} from "viem";
2
+ import { BaseError, } from "viem";
3
3
  export const createDummySigner = (address) => ({
4
4
  signerType: "",
5
5
  inner: undefined,
@@ -8,10 +8,10 @@ export const createDummySigner = (address) => ({
8
8
  },
9
9
  // Not supported on the server
10
10
  signMessage: function (_message) {
11
- throw new Error("Function not implemented.");
11
+ throw new BaseError("signMessage not implemented by dummy signer.");
12
12
  },
13
13
  signTypedData: function (_params) {
14
- throw new Error("Function not implemented.");
14
+ throw new BaseError("signTypedData not implemented by dummy signer.");
15
15
  },
16
16
  });
17
17
  //# sourceMappingURL=createDummySigner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createDummySigner.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createDummySigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,MAAM,cAAc,CAAC;AAEvD,OAAO,EAKN,MAAM,MAAM,CAAC;AAEd,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAgB,EAAsB,EAAE,CAAC,CAAC;IAC1E,UAAU,EAAE,EAAE;IACd,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,KAAK;QACf,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,8BAA8B;IAC9B,WAAW,EAAE,UAAU,QAAyB;QAC9C,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IACD,aAAa,EAAE,UAGb,OAAsD;QACtD,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { type SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { TypedData } from \"abitype\";\nimport {\n type Address,\n type Hex,\n type SignableMessage,\n type TypedDataDefinition,\n} from \"viem\";\n\nexport const createDummySigner = (address: Address): SmartAccountSigner => ({\n signerType: \"\",\n inner: undefined,\n getAddress: async function (): Promise<`0x${string}`> {\n return address;\n },\n // Not supported on the server\n signMessage: function (_message: SignableMessage): Promise<Hex> {\n throw new Error(\"Function not implemented.\");\n },\n signTypedData: function <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData,\n >(_params: TypedDataDefinition<TTypedData, TPrimaryType>): Promise<Hex> {\n throw new Error(\"Function not implemented.\");\n },\n});\n"]}
1
+ {"version":3,"file":"createDummySigner.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createDummySigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,MAAM,cAAc,CAAC;AAEvD,OAAO,EACL,SAAS,GAKV,MAAM,MAAM,CAAC;AAEd,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAgB,EAAsB,EAAE,CAAC,CAAC;IAC1E,UAAU,EAAE,EAAE;IACd,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,KAAK;QACf,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,8BAA8B;IAC9B,WAAW,EAAE,UAAU,QAAyB;QAC9C,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;IACtE,CAAC;IACD,aAAa,EAAE,UAGb,OAAsD;QACtD,MAAM,IAAI,SAAS,CAAC,gDAAgD,CAAC,CAAC;IACxE,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { type SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { TypedData } from \"abitype\";\nimport {\n BaseError,\n type Address,\n type Hex,\n type SignableMessage,\n type TypedDataDefinition,\n} from \"viem\";\n\nexport const createDummySigner = (address: Address): SmartAccountSigner => ({\n signerType: \"\",\n inner: undefined,\n getAddress: async function (): Promise<`0x${string}`> {\n return address;\n },\n // Not supported on the server\n signMessage: function (_message: SignableMessage): Promise<Hex> {\n throw new BaseError(\"signMessage not implemented by dummy signer.\");\n },\n signTypedData: function <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData,\n >(_params: TypedDataDefinition<TTypedData, TPrimaryType>): Promise<Hex> {\n throw new BaseError(\"signTypedData not implemented by dummy signer.\");\n },\n});\n"]}
@@ -1,7 +1,8 @@
1
1
  import type { StaticDecode } from "@sinclair/typebox";
2
2
  import type { TypeSerializedInitcode } from "../../schemas.js";
3
3
  import type { PrepareCallsParams } from "../actions/prepareCalls.js";
4
- export declare function parsePermissionsContext(capabilities: PrepareCallsParams["capabilities"], parsedCi: StaticDecode<typeof TypeSerializedInitcode>): ({
4
+ import type { Address } from "viem";
5
+ export declare function parsePermissionsContext(capabilities: PrepareCallsParams["capabilities"], parsedCi: StaticDecode<typeof TypeSerializedInitcode> | undefined, delegation7702?: Address): ({
5
6
  contextVersion: keyof typeof import("../../exports/internal.js").PermissionsContextVersion;
6
7
  } & {
7
8
  contextVersion: "LOCAL_MODE_DEFERRED_ACTION";
@@ -1,16 +1,28 @@
1
1
  import { InvalidRequestError } from "ox/RpcResponse";
2
2
  import { decodePermissionsContext } from "../../capabilities/permissions/mav2.js";
3
- export function parsePermissionsContext(capabilities, parsedCi) {
4
- if (!capabilities?.permissions?.context) {
3
+ import { getAccountTypeForImplementationAddress7702 } from "./7702.js";
4
+ export function parsePermissionsContext(capabilities, parsedCi, delegation7702) {
5
+ if (!capabilities?.permissions) {
5
6
  return undefined;
6
7
  }
7
- if (capabilities?.permissions?.context &&
8
- parsedCi.factoryType !== "MAv2.0.0-sma-b") {
8
+ if ("sessionId" in capabilities.permissions) {
9
+ throw new InvalidRequestError({
10
+ message: "Remote permissions are not supported in isomorphic client",
11
+ });
12
+ }
13
+ if (!("context" in capabilities.permissions)) {
14
+ return undefined;
15
+ }
16
+ const isMAV2 = (parsedCi && parsedCi.factoryType === "MAv2.0.0-sma-b") ||
17
+ (delegation7702 &&
18
+ getAccountTypeForImplementationAddress7702(delegation7702) ===
19
+ "ModularAccountV2");
20
+ if (!isMAV2) {
9
21
  throw new InvalidRequestError({
10
22
  message: "Permissions are currently only supported by MAv2 accounts",
11
23
  });
12
24
  }
13
- const context = decodePermissionsContext(capabilities.permissions.context);
25
+ const context = decodePermissionsContext(capabilities.permissions);
14
26
  if (context?.contextVersion === "REMOTE_MODE_DEFERRED_ACTION") {
15
27
  throw new InvalidRequestError({
16
28
  message: "Remote mode deferred action not supported in isomorphic client",
@@ -1 +1 @@
1
- {"version":3,"file":"parsePermissionsContext.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/parsePermissionsContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAIlF,MAAM,UAAU,uBAAuB,CACrC,YAAgD,EAChD,QAAqD;IAErD,IAAI,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IACE,YAAY,EAAE,WAAW,EAAE,OAAO;QAClC,QAAQ,CAAC,WAAW,KAAK,gBAAgB,EACzC,CAAC;QACD,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,2DAA2D;SACrE,CAAC,CAAC;IACL,CAAC;IAED,MAAM,OAAO,GAAG,wBAAwB,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAE3E,IAAI,OAAO,EAAE,cAAc,KAAK,6BAA6B,EAAE,CAAC;QAC9D,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,gEAAgE;SAC1E,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { StaticDecode } from \"@sinclair/typebox\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { decodePermissionsContext } from \"../../capabilities/permissions/mav2.js\";\nimport type { TypeSerializedInitcode } from \"../../schemas.js\";\nimport type { PrepareCallsParams } from \"../actions/prepareCalls.js\";\n\nexport function parsePermissionsContext(\n capabilities: PrepareCallsParams[\"capabilities\"],\n parsedCi: StaticDecode<typeof TypeSerializedInitcode>,\n) {\n if (!capabilities?.permissions?.context) {\n return undefined;\n }\n\n if (\n capabilities?.permissions?.context &&\n parsedCi.factoryType !== \"MAv2.0.0-sma-b\"\n ) {\n throw new InvalidRequestError({\n message: \"Permissions are currently only supported by MAv2 accounts\",\n });\n }\n\n const context = decodePermissionsContext(capabilities.permissions.context);\n\n if (context?.contextVersion === \"REMOTE_MODE_DEFERRED_ACTION\") {\n throw new InvalidRequestError({\n message: \"Remote mode deferred action not supported in isomorphic client\",\n });\n }\n\n return context;\n}\n"]}
1
+ {"version":3,"file":"parsePermissionsContext.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/parsePermissionsContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAIlF,OAAO,EAAE,0CAA0C,EAAE,MAAM,WAAW,CAAC;AAEvE,MAAM,UAAU,uBAAuB,CACrC,YAAgD,EAChD,QAAiE,EACjE,cAAwB;IAExB,IAAI,CAAC,YAAY,EAAE,WAAW,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,WAAW,IAAI,YAAY,CAAC,WAAW,EAAE,CAAC;QAC5C,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,2DAA2D;SACrE,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,CAAC,SAAS,IAAI,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GACV,CAAC,QAAQ,IAAI,QAAQ,CAAC,WAAW,KAAK,gBAAgB,CAAC;QACvD,CAAC,cAAc;YACb,0CAA0C,CAAC,cAAc,CAAC;gBACxD,kBAAkB,CAAC,CAAC;IAE1B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,2DAA2D;SACrE,CAAC,CAAC;IACL,CAAC;IAED,MAAM,OAAO,GAAG,wBAAwB,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IAEnE,IAAI,OAAO,EAAE,cAAc,KAAK,6BAA6B,EAAE,CAAC;QAC9D,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,gEAAgE;SAC1E,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { StaticDecode } from \"@sinclair/typebox\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { decodePermissionsContext } from \"../../capabilities/permissions/mav2.js\";\nimport type { TypeSerializedInitcode } from \"../../schemas.js\";\nimport type { PrepareCallsParams } from \"../actions/prepareCalls.js\";\nimport type { Address } from \"viem\";\nimport { getAccountTypeForImplementationAddress7702 } from \"./7702.js\";\n\nexport function parsePermissionsContext(\n capabilities: PrepareCallsParams[\"capabilities\"],\n parsedCi: StaticDecode<typeof TypeSerializedInitcode> | undefined,\n delegation7702?: Address,\n) {\n if (!capabilities?.permissions) {\n return undefined;\n }\n\n if (\"sessionId\" in capabilities.permissions) {\n throw new InvalidRequestError({\n message: \"Remote permissions are not supported in isomorphic client\",\n });\n }\n\n if (!(\"context\" in capabilities.permissions)) {\n return undefined;\n }\n\n const isMAV2 =\n (parsedCi && parsedCi.factoryType === \"MAv2.0.0-sma-b\") ||\n (delegation7702 &&\n getAccountTypeForImplementationAddress7702(delegation7702) ===\n \"ModularAccountV2\");\n\n if (!isMAV2) {\n throw new InvalidRequestError({\n message: \"Permissions are currently only supported by MAv2 accounts\",\n });\n }\n\n const context = decodePermissionsContext(capabilities.permissions);\n\n if (context?.contextVersion === \"REMOTE_MODE_DEFERRED_ACTION\") {\n throw new InvalidRequestError({\n message: \"Remote mode deferred action not supported in isomorphic client\",\n });\n }\n\n return context;\n}\n"]}
@@ -81,7 +81,7 @@ const innerClientActions = (isomorphicClient) => {
81
81
  return {
82
82
  grantPermissions: async (signer, params) => {
83
83
  const { signatureRequest, fullPreSignatureDeferredActionDigest } = await isomorphicClient.createSession(params);
84
- const { signature } = await signSignatureRequest(signer, signatureRequest);
84
+ const { signedAuthorization, signature } = await signSignatureRequest(signer, signatureRequest);
85
85
  return {
86
86
  context: encodePermissionsContext({
87
87
  contextVersion: "LOCAL_MODE_DEFERRED_ACTION",
@@ -90,6 +90,7 @@ const innerClientActions = (isomorphicClient) => {
90
90
  sig: prefixSignatureKeyType(signature, "secp256k1"),
91
91
  }),
92
92
  }),
93
+ signedAuthorization,
93
94
  };
94
95
  },
95
96
  };
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/local/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,EAAqC,MAAM,MAAM,CAAC;AAC/E,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EACL,sBAAsB,GAEvB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,YAAY,GAAG;IACnB,qBAAqB;IACrB,0BAA0B;IAC1B,uBAAuB;IACvB,sBAAsB;CACK,CAAC;AAS9B,MAAM,UAAU,iBAAiB,CAC/B,M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B,CAAC,SAAS,EAAE,WAAW,CAAC;qBACpD,CAAC;iBACH,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { split } from \"@aa-sdk/core\";\nimport { buildDeferredActionDigest } from \"@account-kit/smart-contracts/experimental\";\nimport { createClient, custom, type Address, type JsonRpcAccount } from \"viem\";\nimport {\n encodePermissionsContext,\n prefixSignatureKeyType,\n} from \"../capabilities/permissions/mav2.js\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport type { PrepareCallsParams } from \"../isomorphic/actions/prepareCalls.ts\";\nimport {\n createIsomorphicClient,\n type IsomorphicClient,\n} from \"../isomorphic/client.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n} from \"../types.ts\";\nimport { assertNever } from \"../utils.js\";\n\nconst localMethods = [\n \"wallet_prepareCalls\",\n \"wallet_sendPreparedCalls\",\n \"wallet_getCallsStatus\",\n \"wallet_createSession\",\n] as const satisfies string[];\ntype LocalMethod = (typeof localMethods)[number];\n\nexport function createLocalClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;\n\nexport function createLocalClient(\n params: CreateInnerClientParams,\n): InnerWalletApiClient {\n const { chain, transport, policyId, account } = params;\n const isomorphicClient = createIsomorphicClient({\n transport,\n chain,\n policyId,\n useErc7677middleware: false,\n });\n\n const clientMap: Record<string, ReturnType<typeof createIsomorphicClient>> = {\n [policyId ?? \"default\"]: isomorphicClient,\n };\n\n const innerTransport = split({\n overrides: [\n {\n methods: localMethods,\n transport: custom(\n {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async request(args: { method: LocalMethod; params: any }) {\n switch (args.method) {\n case \"wallet_prepareCalls\": {\n const params = args.params[0] as PrepareCallsParams;\n const capabilityPolicyId =\n params.capabilities?.paymasterService?.policyId;\n\n if (\n capabilityPolicyId != null &&\n policyId !== capabilityPolicyId &&\n !clientMap[capabilityPolicyId]\n ) {\n clientMap[capabilityPolicyId] = createIsomorphicClient({\n transport,\n chain,\n policyId: capabilityPolicyId,\n });\n }\n\n const client =\n clientMap[capabilityPolicyId ?? policyId ?? \"default\"];\n return client.prepareCalls(params);\n }\n case \"wallet_sendPreparedCalls\":\n return isomorphicClient.sendPreparedCalls(args.params[0]);\n case \"wallet_getCallsStatus\":\n return isomorphicClient.getCallsStatus(args.params[0]);\n case \"wallet_createSession\": {\n return isomorphicClient.createSession(args.params[0]);\n }\n default:\n return assertNever(\n args.method,\n `Unexpected method: ${args.method}`,\n );\n }\n },\n },\n {\n retryCount: 0,\n },\n ),\n },\n ],\n fallback: transport,\n });\n\n return createClient({\n transport: innerTransport,\n chain,\n account,\n })\n .extend(() => ({\n policyId,\n ...innerClientActions(isomorphicClient),\n }))\n .extend(() => ({\n internal: internalStateDecorator(),\n }));\n}\n\nconst innerClientActions = (\n isomorphicClient: IsomorphicClient,\n): InnerClientActions => {\n return {\n grantPermissions: async (signer, params) => {\n const { signatureRequest, fullPreSignatureDeferredActionDigest } =\n await isomorphicClient.createSession(params);\n\n const { signature } = await signSignatureRequest(\n signer,\n signatureRequest,\n );\n\n return {\n context: encodePermissionsContext({\n contextVersion: \"LOCAL_MODE_DEFERRED_ACTION\",\n deferredAction: buildDeferredActionDigest({\n fullPreSignatureDeferredActionDigest,\n sig: prefixSignatureKeyType(signature, \"secp256k1\"),\n }),\n }),\n };\n },\n };\n};\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/local/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,EAAqC,MAAM,MAAM,CAAC;AAC/E,OAAO,EACL,wB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E,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,EAAE,gBAAgB,EAAE,oCAAoC,EAAE,GAC9D,MAAM,gBAAgB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC/C,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,GAAG,MAAM,oBAAoB,CACnE,MAAM,EACN,gBAAgB,CACjB,CAAC;YACF,OAAO;gBACL,OAAO,EAAE,wBAAwB,CAAC;oBAChC,cAAc,EAAE,4BAA4B;oBAC5C,cAAc,EAAE,yBAAyB,CAAC;wBACxC,oCAAoC;wBACpC,GAAG,EAAE,sBAAsB,CAAC,SAAS,EAAE,WAAW,CAAC;qBACpD,CAAC;iBACH,CAAC;gBACF,mBAAmB;aACpB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { split } from \"@aa-sdk/core\";\nimport { buildDeferredActionDigest } from \"@account-kit/smart-contracts/experimental\";\nimport { createClient, custom, type Address, type JsonRpcAccount } from \"viem\";\nimport {\n encodePermissionsContext,\n prefixSignatureKeyType,\n} from \"../capabilities/permissions/mav2.js\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport type { PrepareCallsParams } from \"../isomorphic/actions/prepareCalls.ts\";\nimport {\n createIsomorphicClient,\n type IsomorphicClient,\n} from \"../isomorphic/client.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n} from \"../types.ts\";\nimport { assertNever } from \"../utils.js\";\n\nconst localMethods = [\n \"wallet_prepareCalls\",\n \"wallet_sendPreparedCalls\",\n \"wallet_getCallsStatus\",\n \"wallet_createSession\",\n] as const satisfies string[];\ntype LocalMethod = (typeof localMethods)[number];\n\nexport function createLocalClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;\n\nexport function createLocalClient(\n params: CreateInnerClientParams,\n): InnerWalletApiClient {\n const { chain, transport, policyId, account } = params;\n const isomorphicClient = createIsomorphicClient({\n transport,\n chain,\n policyId,\n useErc7677middleware: false,\n });\n\n const clientMap: Record<string, ReturnType<typeof createIsomorphicClient>> = {\n [policyId ?? \"default\"]: isomorphicClient,\n };\n\n const innerTransport = split({\n overrides: [\n {\n methods: localMethods,\n transport: custom(\n {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async request(args: { method: LocalMethod; params: any }) {\n switch (args.method) {\n case \"wallet_prepareCalls\": {\n const params = args.params[0] as PrepareCallsParams;\n const capabilityPolicyId =\n params.capabilities?.paymasterService?.policyId;\n\n if (\n capabilityPolicyId != null &&\n policyId !== capabilityPolicyId &&\n !clientMap[capabilityPolicyId]\n ) {\n clientMap[capabilityPolicyId] = createIsomorphicClient({\n transport,\n chain,\n policyId: capabilityPolicyId,\n });\n }\n\n const client =\n clientMap[capabilityPolicyId ?? policyId ?? \"default\"];\n return client.prepareCalls(params);\n }\n case \"wallet_sendPreparedCalls\":\n return isomorphicClient.sendPreparedCalls(args.params[0]);\n case \"wallet_getCallsStatus\":\n return isomorphicClient.getCallsStatus(args.params[0]);\n case \"wallet_createSession\": {\n return isomorphicClient.createSession(args.params[0]);\n }\n default:\n return assertNever(\n args.method,\n `Unexpected method: ${args.method}`,\n );\n }\n },\n },\n {\n retryCount: 0,\n },\n ),\n },\n ],\n fallback: transport,\n });\n\n return createClient({\n transport: innerTransport,\n chain,\n account,\n })\n .extend(() => ({\n policyId,\n ...innerClientActions(isomorphicClient),\n }))\n .extend(() => ({\n internal: internalStateDecorator(),\n }));\n}\n\nconst innerClientActions = (\n isomorphicClient: IsomorphicClient,\n): InnerClientActions => {\n return {\n grantPermissions: async (signer, params) => {\n const { signatureRequest, fullPreSignatureDeferredActionDigest } =\n await isomorphicClient.createSession(params);\n const { signedAuthorization, signature } = await signSignatureRequest(\n signer,\n signatureRequest,\n );\n return {\n context: encodePermissionsContext({\n contextVersion: \"LOCAL_MODE_DEFERRED_ACTION\",\n deferredAction: buildDeferredActionDigest({\n fullPreSignatureDeferredActionDigest,\n sig: prefixSignatureKeyType(signature, \"secp256k1\"),\n }),\n }),\n signedAuthorization,\n };\n },\n };\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import { Provider } from "ox";
2
- import { createClient, custom } from "viem";
2
+ import { BaseError, createClient, custom, } from "viem";
3
3
  import { encodePermissionsContext } from "../capabilities/permissions/mav2.js";
4
4
  import { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
5
5
  import { internalStateDecorator } from "../internal/decorator.js";
@@ -33,13 +33,17 @@ const innerClientActions = (apiClient) => {
33
33
  method: "wallet_createSession",
34
34
  params: [params],
35
35
  });
36
- const { signature } = await signSignatureRequest(signer, signatureRequest);
36
+ if (signatureRequest.type !== "eth_signTypedData_v4") {
37
+ throw new BaseError("Unexpected signature request type");
38
+ }
39
+ const { signedAuthorization, signature } = await signSignatureRequest(signer, signatureRequest);
37
40
  return {
38
41
  context: encodePermissionsContext({
39
42
  contextVersion: "REMOTE_MODE_DEFERRED_ACTION",
40
43
  sessionId,
41
44
  signature,
42
45
  }),
46
+ signedAuthorization,
43
47
  };
44
48
  },
45
49
  };
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/remote/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAqC,MAAM,MAAM,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAczD;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAA+B;IAE/B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAE7C,MAAM,MAAM,GAAG,YAAY,CAAC;QAC1B,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAClB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC,CACvE,IAAI,CACL;QACH,KAAK;QACL,OAAO;KACR,CAAC;SACC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,GAAG,kBAAkB,CAAC,OAAO,CAAC;KAC/B,CAAC,CAAC;SACF,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACb,QAAQ,EAAE,sBAAsB,EAAE;KACnC,CAAC,CAAC,CAAC;IAEN,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,kBAAkB,GAAG,CACzB,SAAmC,EACf,EAAE;IACtB,OAAO;QACL,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC;gBAC9D,MAAM,EAAE,sBAAsB;gBAC9B,MAAM,EAAE,CAAC,MAAM,CAAC;aACjB,CAAC,CAAC;YACH,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,oBAAoB,CAC9C,MAAM,EACN,gBAAgB,CACjB,CAAC;YACF,OAAO;gBACL,OAAO,EAAE,wBAAwB,CAAC;oBAChC,cAAc,EAAE,6BAA6B;oBAC7C,SAAS;oBACT,SAAS;iBACV,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Provider } from \"ox\";\nimport { createClient, custom, type Address, type JsonRpcAccount } from \"viem\";\nimport { encodePermissionsContext } from \"../capabilities/permissions/mav2.js\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport { WalletServerRpcSchema } from \"../rpc/schema.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n InnerWalletApiClientBase,\n} from \"../types.ts\";\n\nexport function createRemoteClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;\n\n/**\n * This is a low-level client just used to make RPC requests in remote mode\n * This should be wrapped by a higher-level smart account client that provides actions\n * that uses this client under the hood\n * @returns\n */\nexport function createRemoteClient(\n params: CreateInnerClientParams,\n): InnerWalletApiClient {\n const { transport, chain, account } = params;\n\n const client = createClient({\n transport: (opts) =>\n custom(Provider.from(transport(opts), { schema: WalletServerRpcSchema }))(\n opts,\n ),\n chain,\n account,\n })\n .extend((_client) => ({\n policyId: params.policyId,\n ...innerClientActions(_client),\n }))\n .extend(() => ({\n internal: internalStateDecorator(),\n }));\n\n return client;\n}\n\nconst innerClientActions = (\n apiClient: InnerWalletApiClientBase,\n): InnerClientActions => {\n return {\n grantPermissions: async (signer, params) => {\n const { sessionId, signatureRequest } = await apiClient.request({\n method: \"wallet_createSession\",\n params: [params],\n });\n const { signature } = await signSignatureRequest(\n signer,\n signatureRequest,\n );\n return {\n context: encodePermissionsContext({\n contextVersion: \"REMOTE_MODE_DEFERRED_ACTION\",\n sessionId,\n signature,\n }),\n };\n },\n };\n};\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/remote/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EACL,SAAS,EACT,YAAY,EACZ,MAAM,GAGP,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC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MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,GAAG,MAAM,oBAAoB,CACnE,MAAM,EACN,gBAAgB,CACjB,CAAC;YACF,OAAO;gBACL,OAAO,EAAE,wBAAwB,CAAC;oBAChC,cAAc,EAAE,6BAA6B;oBAC7C,SAAS;oBACT,SAAS;iBACV,CAAC;gBACF,mBAAmB;aACpB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Provider } from \"ox\";\nimport {\n BaseError,\n createClient,\n custom,\n type Address,\n type JsonRpcAccount,\n} from \"viem\";\nimport { encodePermissionsContext } from \"../capabilities/permissions/mav2.js\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport { WalletServerRpcSchema } from \"../rpc/schema.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n InnerWalletApiClientBase,\n} from \"../types.ts\";\n\nexport function createRemoteClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;\n\n/**\n * This is a low-level client just used to make RPC requests in remote mode\n * This should be wrapped by a higher-level smart account client that provides actions\n * that uses this client under the hood\n * @returns\n */\nexport function createRemoteClient(\n params: CreateInnerClientParams,\n): InnerWalletApiClient {\n const { transport, chain, account } = params;\n\n const client = createClient({\n transport: (opts) =>\n custom(Provider.from(transport(opts), { schema: WalletServerRpcSchema }))(\n opts,\n ),\n chain,\n account,\n })\n .extend((_client) => ({\n policyId: params.policyId,\n ...innerClientActions(_client),\n }))\n .extend(() => ({\n internal: internalStateDecorator(),\n }));\n\n return client;\n}\n\nconst innerClientActions = (\n apiClient: InnerWalletApiClientBase,\n): InnerClientActions => {\n return {\n grantPermissions: async (signer, params) => {\n const { sessionId, signatureRequest } = await apiClient.request({\n method: \"wallet_createSession\",\n params: [params],\n });\n if (signatureRequest.type !== \"eth_signTypedData_v4\") {\n throw new BaseError(\"Unexpected signature request type\");\n }\n const { signedAuthorization, signature } = await signSignatureRequest(\n signer,\n signatureRequest,\n );\n return {\n context: encodePermissionsContext({\n contextVersion: \"REMOTE_MODE_DEFERRED_ACTION\",\n sessionId,\n signature,\n }),\n signedAuthorization,\n };\n },\n };\n};\n"]}
@@ -0,0 +1,230 @@
1
+ export declare const Examples: {
2
+ PrepareCalls: readonly [{
3
+ readonly name: "wallet_prepareCalls example";
4
+ readonly params: readonly [{
5
+ readonly name: "Request";
6
+ readonly value: readonly [{
7
+ readonly calls: readonly [{
8
+ readonly to: "0x1234567890123456789012345678901234567890";
9
+ readonly data: "0x";
10
+ }];
11
+ readonly from: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A";
12
+ readonly chainId: "0x01";
13
+ readonly capabilities: {
14
+ readonly paymasterService: {
15
+ readonly policyId: "11111111-2222-3333-4444-555555555555";
16
+ };
17
+ };
18
+ }];
19
+ }];
20
+ readonly result: {
21
+ readonly name: "Response";
22
+ readonly value: {
23
+ readonly type: "user-operation-v070";
24
+ readonly data: {
25
+ readonly sender: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A";
26
+ readonly nonce: "0x10000000000000000";
27
+ readonly callData: "0x34fcd5be0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000";
28
+ readonly paymaster: "0x3f222Df6aB18C1E10d0Ec136503c3B0dfd929048";
29
+ readonly paymasterData: "0x0000000000000000682d7e7c9fa6f71c28c31141a11ac9eb2bdbe898ddbd42a4f7085f8bb3380ba75dd9231a386e24fe5a84777217c907391e983b5b0f78a4a9d0fd1c8631dd22c10e106b461c";
30
+ readonly paymasterPostOpGasLimit: "0x0";
31
+ readonly paymasterVerificationGasLimit: "0x74d3";
32
+ readonly maxPriorityFeePerGas: "0x60e4b0";
33
+ readonly maxFeePerGas: "0x1bf52290";
34
+ readonly callGasLimit: "0x2bb8";
35
+ readonly verificationGasLimit: "0xc845";
36
+ readonly preVerificationGas: "0x14b74";
37
+ };
38
+ readonly chainId: "0x66eee";
39
+ readonly signatureRequest: {
40
+ readonly type: "personal_sign";
41
+ readonly data: {
42
+ readonly raw: "0xc69e468aa6fafb5c7298c02841e76f976b433018266af39a5807bc29ea9ad392";
43
+ };
44
+ };
45
+ };
46
+ };
47
+ }];
48
+ SendPreparedCalls: readonly [{
49
+ readonly name: "wallet_sendPreparedCalls example";
50
+ readonly params: readonly [{
51
+ readonly name: "Request";
52
+ readonly value: readonly [{
53
+ readonly type: "user-operation-v070";
54
+ readonly data: {
55
+ readonly sender: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A";
56
+ readonly nonce: "0x10000000000000000";
57
+ readonly callData: "0x34fcd5be0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000";
58
+ readonly paymaster: "0x3f222Df6aB18C1E10d0Ec136503c3B0dfd929048";
59
+ readonly paymasterData: "0x0000000000000000682d7e7c9fa6f71c28c31141a11ac9eb2bdbe898ddbd42a4f7085f8bb3380ba75dd9231a386e24fe5a84777217c907391e983b5b0f78a4a9d0fd1c8631dd22c10e106b461c";
60
+ readonly paymasterPostOpGasLimit: "0x0";
61
+ readonly paymasterVerificationGasLimit: "0x74d3";
62
+ readonly maxPriorityFeePerGas: "0x60e4b0";
63
+ readonly maxFeePerGas: "0x1bf52290";
64
+ readonly callGasLimit: "0x2bb8";
65
+ readonly verificationGasLimit: "0xc845";
66
+ readonly preVerificationGas: "0x14b74";
67
+ };
68
+ readonly chainId: "0x66eee";
69
+ readonly signature: {
70
+ readonly type: "ecdsa";
71
+ readonly signature: "0xb1a055089b1ba8387ed435f2bd0afe7ff69f22b928cdfdea1b5323c64d6af387164de3fa6febf031b544de46a84d6fb7f084b9798ddfaba820950c257139a7321b";
72
+ };
73
+ }];
74
+ }];
75
+ readonly result: {
76
+ readonly name: "Response";
77
+ readonly value: {
78
+ readonly preparedCallIds: readonly ["0x0000000000000000000000000000000000000000000000000000000000066eeec69e468aa6fafb5c7298c02841e76f976b433018266af39a5807bc29ea9ad392"];
79
+ };
80
+ };
81
+ }];
82
+ RequestAccount: readonly [{
83
+ readonly name: "wallet_requestAccount example";
84
+ readonly params: readonly [{
85
+ readonly name: "Request";
86
+ readonly value: readonly [{
87
+ readonly signerAddress: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A";
88
+ }];
89
+ }];
90
+ readonly result: {
91
+ readonly name: "Response";
92
+ readonly value: {
93
+ readonly accountAddress: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A";
94
+ readonly id: "3061cc5f-1f96-48a9-ab45-41faad2dd23b";
95
+ };
96
+ };
97
+ }];
98
+ CreateAccount: readonly [{
99
+ readonly name: "wallet_createAccount example";
100
+ readonly params: readonly [{
101
+ readonly name: "Request";
102
+ readonly value: readonly [{
103
+ readonly signerAddress: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A";
104
+ readonly creationOption: {
105
+ readonly salt: "0x10";
106
+ };
107
+ }];
108
+ }];
109
+ readonly result: {
110
+ readonly name: "Response";
111
+ readonly value: {
112
+ readonly accountAddress: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A";
113
+ readonly id: "3061cc5f-1f96-48a9-ab45-41faad2dd23b";
114
+ };
115
+ };
116
+ }];
117
+ ListAccounts: readonly [{
118
+ readonly name: "wallet_listAccounts example";
119
+ readonly params: readonly [{
120
+ readonly name: "Request";
121
+ readonly value: readonly [{
122
+ readonly signerAddress: "0x6275B53E98D07c729108A177207634eA22F5A748";
123
+ }];
124
+ }];
125
+ readonly result: {
126
+ readonly name: "Response";
127
+ readonly value: {
128
+ readonly accounts: readonly [{
129
+ readonly accountAddress: "0xafdABa1E09e82F780721963eba39bA9e6d9FE4d2";
130
+ readonly id: "3d8b3315-4aa1-4c67-8c82-20221e8dbf16";
131
+ }];
132
+ readonly meta: {
133
+ readonly totalCount: 1;
134
+ readonly after: null;
135
+ };
136
+ };
137
+ };
138
+ }];
139
+ CreateSession: readonly [{
140
+ readonly name: "wallet_createSession example";
141
+ readonly params: readonly [{
142
+ readonly name: "Request";
143
+ readonly value: readonly [{
144
+ readonly account: "0xafdABa1E09e82F780721963eba39bA9e6d9FE4d2";
145
+ readonly chainId: "0x01";
146
+ readonly key: {
147
+ readonly publicKey: "0x647bbf38CD0E116d1672405aE17a775572a84e03";
148
+ readonly type: "secp256k1";
149
+ };
150
+ readonly permissions: readonly [{
151
+ readonly type: "root";
152
+ }];
153
+ readonly expiry: 1747969653;
154
+ }];
155
+ }];
156
+ readonly result: {
157
+ readonly name: "Response";
158
+ readonly value: {
159
+ readonly sessionId: "0xcd8b2d07a6fa76f1e8a5eaa8f3a7883c";
160
+ readonly signatureRequest: {
161
+ readonly type: "eth_signTypedData_v4";
162
+ readonly data: {
163
+ readonly domain: {
164
+ readonly chainId: 1;
165
+ readonly verifyingContract: "0xafdABa1E09e82F780721963eba39bA9e6d9FE4d2";
166
+ };
167
+ readonly types: {
168
+ readonly DeferredAction: readonly [{
169
+ readonly name: "nonce";
170
+ readonly type: "uint256";
171
+ }, {
172
+ readonly name: "deadline";
173
+ readonly type: "uint48";
174
+ }, {
175
+ readonly name: "call";
176
+ readonly type: "bytes";
177
+ }];
178
+ };
179
+ readonly primaryType: "DeferredAction";
180
+ readonly message: {
181
+ readonly nonce: "0x1030000000000000000";
182
+ readonly deadline: 1747969653;
183
+ readonly call: "0x1bbf564c00000000000099DE0BF6fA90dEB851E2A2df7d83000000010500000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000647bbf38cd0e116d1672405ae17a775572a84e0300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000007900000000000082B8e2012be914dFA4f62A0573eA0000000101000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000682fe675000000000000000000000000000000000000000000000000000000000000000000000000000000";
184
+ };
185
+ };
186
+ };
187
+ };
188
+ };
189
+ }];
190
+ GetCallsStatus: readonly [{
191
+ readonly name: "wallet_getCallsStatus example";
192
+ readonly params: readonly [{
193
+ readonly name: "Request";
194
+ readonly value: readonly ["0x0000000000000000000000000000000000000000000000000000000000066eee1057eff9529142aa3b74adcaacfce5b99a09d80c9f2e38e35ea1f27535e61477"];
195
+ }];
196
+ readonly result: {
197
+ readonly name: "Response";
198
+ readonly value: {
199
+ readonly id: "0x0000000000000000000000000000000000000000000000000000000000066eee1057eff9529142aa3b74adcaacfce5b99a09d80c9f2e38e35ea1f27535e61477";
200
+ readonly chainId: "0x66eee";
201
+ readonly atomic: true;
202
+ readonly status: 200;
203
+ readonly receipts: readonly [{
204
+ readonly status: "0x1";
205
+ readonly blockHash: "0x7c6f2f548c0ad4434dfb64f49a810bc795dadcd4cbec948bf8d4ae81a10fed5e";
206
+ readonly blockNumber: "0x8ba5f79";
207
+ readonly gasUsed: "0x33c65";
208
+ readonly transactionHash: "0x8ec28074a461102e4dbe43cb4aa9fed3e8c1274f1f1b0d5f6a0919ce7e20f517";
209
+ readonly logs: readonly [{
210
+ readonly address: "0x00000000000017c61b5bee81050ec8efc9c6fecd";
211
+ readonly data: "0x0000000000000000000000000000000000000000000000000000000000000000";
212
+ readonly topics: readonly ["0xd32049610f0cd3babd266cf338d726cc8c34c8ff97356c0f33c13fa59962ac92", "0x000000000000000000000000f13223cca0ae9786dd91dffe1f4e834c71ccdc2d", "0x0000000000000000000000003f3503e682bf27330f9e5065043d47207e609e7d"];
213
+ }, {
214
+ readonly address: "0x0000000071727de22e5e9d8baf0edac6f37da032";
215
+ readonly data: "0x00000000000000000000000000000000000017c61b5bee81050ec8efc9c6fecd0000000000000000000000002cc0c7981d846b9f2a16276556f6e8cb52bfb633";
216
+ readonly topics: readonly ["0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d", "0x1057eff9529142aa3b74adcaacfce5b99a09d80c9f2e38e35ea1f27535e61477", "0x000000000000000000000000f13223cca0ae9786dd91dffe1f4e834c71ccdc2d"];
217
+ }, {
218
+ readonly address: "0x0000000071727de22e5e9d8baf0edac6f37da032";
219
+ readonly data: "0x";
220
+ readonly topics: readonly ["0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972"];
221
+ }, {
222
+ readonly address: "0x0000000071727de22e5e9d8baf0edac6f37da032";
223
+ readonly data: "0x00000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000014ba6c2cd4f0000000000000000000000000000000000000000000000000000000000003451d";
224
+ readonly topics: readonly ["0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f", "0x1057eff9529142aa3b74adcaacfce5b99a09d80c9f2e38e35ea1f27535e61477", "0x000000000000000000000000f13223cca0ae9786dd91dffe1f4e834c71ccdc2d", "0x0000000000000000000000002cc0c7981d846b9f2a16276556f6e8cb52bfb633"];
225
+ }];
226
+ }];
227
+ };
228
+ };
229
+ }];
230
+ };