@account-kit/wallet-client 0.1.0-alpha.7 → 0.1.0-alpha.8

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 (57) hide show
  1. package/dist/esm/client/actions/prepareCalls.d.ts +1 -1
  2. package/dist/esm/client/actions/prepareCalls.js +1 -1
  3. package/dist/esm/client/actions/prepareCalls.js.map +1 -1
  4. package/dist/esm/client/actions/signSignatureRequest.d.ts +3 -2
  5. package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
  6. package/dist/esm/isomorphic/actions/createSession.js +11 -2
  7. package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
  8. package/dist/esm/isomorphic/actions/prepareCalls.js +21 -14
  9. package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
  10. package/dist/esm/isomorphic/actions/sendPreparedCalls.js +53 -8
  11. package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
  12. package/dist/esm/isomorphic/client.d.ts +9 -0
  13. package/dist/esm/isomorphic/utils/7702.js +21 -8
  14. package/dist/esm/isomorphic/utils/7702.js.map +1 -1
  15. package/dist/esm/isomorphic/utils/createAccount.js +73 -33
  16. package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
  17. package/dist/esm/isomorphic/utils/supportsFeature.d.ts +4 -0
  18. package/dist/esm/isomorphic/utils/supportsFeature.js +21 -0
  19. package/dist/esm/isomorphic/utils/supportsFeature.js.map +1 -0
  20. package/dist/esm/rpc/request.d.ts +12 -2
  21. package/dist/esm/rpc/schema.d.ts +12 -2
  22. package/dist/esm/schemas.d.ts +16 -1
  23. package/dist/esm/schemas.js +12 -1
  24. package/dist/esm/schemas.js.map +1 -1
  25. package/dist/esm/types.d.ts +3 -0
  26. package/dist/esm/types.js.map +1 -1
  27. package/dist/types/client/actions/prepareCalls.d.ts +1 -1
  28. package/dist/types/client/actions/signSignatureRequest.d.ts +3 -2
  29. package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
  30. package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
  31. package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
  32. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
  33. package/dist/types/isomorphic/client.d.ts +9 -0
  34. package/dist/types/isomorphic/client.d.ts.map +1 -1
  35. package/dist/types/isomorphic/utils/7702.d.ts.map +1 -1
  36. package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -1
  37. package/dist/types/isomorphic/utils/supportsFeature.d.ts +5 -0
  38. package/dist/types/isomorphic/utils/supportsFeature.d.ts.map +1 -0
  39. package/dist/types/rpc/request.d.ts +12 -2
  40. package/dist/types/rpc/request.d.ts.map +1 -1
  41. package/dist/types/rpc/schema.d.ts +12 -2
  42. package/dist/types/rpc/schema.d.ts.map +1 -1
  43. package/dist/types/schemas.d.ts +16 -1
  44. package/dist/types/schemas.d.ts.map +1 -1
  45. package/dist/types/types.d.ts +3 -0
  46. package/dist/types/types.d.ts.map +1 -1
  47. package/package.json +2 -2
  48. package/src/client/actions/prepareCalls.ts +1 -1
  49. package/src/client/actions/signSignatureRequest.ts +4 -2
  50. package/src/isomorphic/actions/createSession.ts +14 -1
  51. package/src/isomorphic/actions/prepareCalls.ts +22 -13
  52. package/src/isomorphic/actions/sendPreparedCalls.ts +59 -9
  53. package/src/isomorphic/utils/7702.ts +25 -9
  54. package/src/isomorphic/utils/createAccount.ts +81 -34
  55. package/src/isomorphic/utils/supportsFeature.ts +34 -0
  56. package/src/schemas.ts +20 -1
  57. package/src/types.ts +4 -0
@@ -1,10 +1,10 @@
1
- import { createModularAccountV2, } from "@account-kit/smart-contracts";
1
+ import { createLightAccount, createModularAccountV2, } from "@account-kit/smart-contracts";
2
2
  import { concatHex, hexToNumber } from "viem";
3
3
  import { parsePermissionsContext } from "./parsePermissionsContext.js";
4
4
  import { assertNever } from "../../utils.js";
5
5
  import { getAccountTypeForDelegationAddress7702 } from "./7702.js";
6
- import { InternalError } from "ox/RpcResponse";
7
6
  import { PermissionsCapability } from "../../capabilities/permissions/index.js";
7
+ import { InternalError, InvalidRequestError } from "ox/RpcResponse";
8
8
  /**
9
9
  * Creates a smart account instance from the given parameters.
10
10
  * @param params - The parameters for creating a smart account.
@@ -12,30 +12,8 @@ import { PermissionsCapability } from "../../capabilities/permissions/index.js";
12
12
  */
13
13
  export async function createAccount(params) {
14
14
  const { counterfactualInfo: ci, ...accountParams } = params;
15
- const mode = params.delegation ? "7702" : "default";
16
- if (mode === "default") {
17
- if (!ci) {
18
- throw new InternalError({
19
- message: "Counterfactual info not found",
20
- });
21
- }
22
- if (ci.factoryType !== "MAv2.0.0-sma-b") {
23
- throw new InternalError({
24
- message: `Factory type ${ci.factoryType} is not currently supported.`,
25
- });
26
- }
27
- }
28
- else if (mode === "7702") {
29
- const accountType = getAccountTypeForDelegationAddress7702(params.delegation);
30
- if (accountType !== "ModularAccountV2") {
31
- throw new InternalError({
32
- message: "7702 mode currently only supports ModularAccountV2",
33
- });
34
- }
35
- }
36
- else {
37
- assertNever(mode, "Unexpected mode in createAccount");
38
- }
15
+ // This throws if we pass a permission context and the account is not MA-v2
16
+ // TODO: test that this edge case is handled correctly
39
17
  const parsedContext = parsePermissionsContext(params.permissions, ci, params.delegation);
40
18
  const signerEntity = parsedContext?.contextVersion === "NON_DEFERRED_ACTION"
41
19
  ? {
@@ -43,14 +21,76 @@ export async function createAccount(params) {
43
21
  isGlobalValidation: parsedContext.isGlobalValidation,
44
22
  }
45
23
  : undefined;
46
- // TODO: clean this up to support different account types.
47
- return createModularAccountV2({
24
+ const mode = params.delegation ? "7702" : "default";
25
+ if (mode === "7702") {
26
+ const accountType = getAccountTypeForDelegationAddress7702(params.delegation);
27
+ if (accountType !== "ModularAccountV2") {
28
+ throw new Error("7702 mode currently only supports ModularAccountV2");
29
+ }
30
+ return createModularAccountV2({
31
+ ...accountParams,
32
+ signerEntity,
33
+ deferredAction: parsedContext?.deferredAction,
34
+ mode,
35
+ });
36
+ }
37
+ if (mode !== "default") {
38
+ return assertNever(mode, "Unexpected mode in createAccount");
39
+ }
40
+ // At this point, we are guaranteed to be in default mode, where ci
41
+ // (counterfactualInfo) must be defined
42
+ if (!ci) {
43
+ throw new InternalError({
44
+ message: "Counterfactual info not found",
45
+ });
46
+ }
47
+ const factoryType = ci.factoryType;
48
+ const commonParams = {
48
49
  ...accountParams,
49
- signerEntity,
50
- deferredAction: parsedContext?.deferredAction,
51
- initCode: ci ? concatHex([ci.factoryAddress, ci.factoryData]) : undefined,
52
- mode,
53
- });
50
+ initCode: concatHex([ci.factoryAddress, ci.factoryData]),
51
+ };
52
+ // Return the account created based on the factory type
53
+ switch (factoryType) {
54
+ case "MAv2.0.0-sma-b":
55
+ return createModularAccountV2({
56
+ ...commonParams,
57
+ signerEntity,
58
+ deferredAction: parsedContext?.deferredAction,
59
+ mode,
60
+ });
61
+ case "LightAccountV2.0.0":
62
+ return createLightAccount({
63
+ ...commonParams,
64
+ version: "v2.0.0",
65
+ });
66
+ case "LightAccountV1.0.1":
67
+ return createLightAccount({
68
+ ...commonParams,
69
+ version: "v1.0.1",
70
+ });
71
+ case "LightAccountV1.0.2":
72
+ return createLightAccount({
73
+ ...commonParams,
74
+ version: "v1.0.2",
75
+ });
76
+ case "LightAccountV1.1.0":
77
+ return createLightAccount({
78
+ ...commonParams,
79
+ version: "v1.1.0",
80
+ });
81
+ case "LightAccountV2.0.0-MultiOwner":
82
+ case "MAv1.0.0-MultiOwner":
83
+ case "MAv1.0.0-MultiSig":
84
+ case "MAv2.0.0-ma-ssv":
85
+ case "MAv2.0.0-ma-webauthn":
86
+ case "unknown":
87
+ case undefined:
88
+ throw new InvalidRequestError({
89
+ message: `Account type currently unsupported: ${factoryType}`,
90
+ });
91
+ default:
92
+ return assertNever(factoryType, "Unsupported factory type");
93
+ }
54
94
  }
55
95
  export function isModularAccountV2(account) {
56
96
  return account.source === "ModularAccountV2";
@@ -1 +1 @@
1
- {"version":3,"file":"createAccount.js","sourceR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9D,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,WAAW,EAClB,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 { TypeSerializedInitcode } from \"../../schemas.js\";\nimport { parsePermissionsContext } from \"./parsePermissionsContext.js\";\nimport { assertNever } from \"../../utils.js\";\nimport { getAccountTypeForDelegationAddress7702 } from \"./7702.js\";\nimport { InternalError } from \"ox/RpcResponse\";\nimport { PermissionsCapability } from \"../../capabilities/permissions/index.js\";\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 permissions?: StaticDecode<typeof PermissionsCapability>;\n delegation?: Address;\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 = getAccountTypeForDelegationAddress7702(\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.permissions,\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
+ {"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createAccount.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,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AAC;QACzB,KAAK,iBAAiB,CAAC;QACvB,KAAK,sBAAsB,CAAC;QAC5B,KAAK,SAAS,CAAC;QACf,KAAK,SAAS;YACZ,MAAM,IAAI,mBAAmB,CAAC;gBAC5B,OAAO,EAAE,uCAAuC,WAAW,EAAE;aAC9D,CAAC,CAAC;QACL;YACE,OAAO,WAAW,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC;IAChE,CAAC;AACH,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 createLightAccount,\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 { TypeSerializedInitcode } from \"../../schemas.js\";\nimport { parsePermissionsContext } from \"./parsePermissionsContext.js\";\nimport { assertNever } from \"../../utils.js\";\nimport { getAccountTypeForDelegationAddress7702 } from \"./7702.js\";\nimport { PermissionsCapability } from \"../../capabilities/permissions/index.js\";\nimport { InternalError, InvalidRequestError } 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 permissions?: StaticDecode<typeof PermissionsCapability>;\n delegation?: Address;\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 // This throws if we pass a permission context and the account is not MA-v2\n // TODO: test that this edge case is handled correctly\n const parsedContext = parsePermissionsContext(\n params.permissions,\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 const mode = params.delegation ? \"7702\" : \"default\";\n\n if (mode === \"7702\") {\n const accountType = getAccountTypeForDelegationAddress7702(\n params.delegation!,\n );\n if (accountType !== \"ModularAccountV2\") {\n throw new Error(\"7702 mode currently only supports ModularAccountV2\");\n }\n return createModularAccountV2({\n ...accountParams,\n signerEntity,\n deferredAction: parsedContext?.deferredAction,\n mode,\n });\n }\n\n if (mode !== \"default\") {\n return assertNever(mode, \"Unexpected mode in createAccount\");\n }\n\n // At this point, we are guaranteed to be in default mode, where ci\n // (counterfactualInfo) must be defined\n\n if (!ci) {\n throw new InternalError({\n message: \"Counterfactual info not found\",\n });\n }\n\n const factoryType = ci.factoryType;\n const commonParams = {\n ...accountParams,\n initCode: concatHex([ci.factoryAddress, ci.factoryData]),\n };\n\n // Return the account created based on the factory type\n switch (factoryType) {\n case \"MAv2.0.0-sma-b\":\n return createModularAccountV2({\n ...commonParams,\n signerEntity,\n deferredAction: parsedContext?.deferredAction,\n mode,\n });\n case \"LightAccountV2.0.0\":\n return createLightAccount({\n ...commonParams,\n version: \"v2.0.0\",\n });\n case \"LightAccountV1.0.1\":\n return createLightAccount({\n ...commonParams,\n version: \"v1.0.1\",\n });\n case \"LightAccountV1.0.2\":\n return createLightAccount({\n ...commonParams,\n version: \"v1.0.2\",\n });\n case \"LightAccountV1.1.0\":\n return createLightAccount({\n ...commonParams,\n version: \"v1.1.0\",\n });\n case \"LightAccountV2.0.0-MultiOwner\":\n case \"MAv1.0.0-MultiOwner\":\n case \"MAv1.0.0-MultiSig\":\n case \"MAv2.0.0-ma-ssv\":\n case \"MAv2.0.0-ma-webauthn\":\n case \"unknown\":\n case undefined:\n throw new InvalidRequestError({\n message: `Account type currently unsupported: ${factoryType}`,\n });\n default:\n return assertNever(factoryType, \"Unsupported factory type\");\n }\n}\n\nexport function isModularAccountV2(\n account: SmartContractAccount,\n): account is ModularAccountV2 {\n return account.source === \"ModularAccountV2\";\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { StaticDecode } from "@sinclair/typebox";
2
+ import type { TypeSerializedInitcode } from "../../schemas.ts";
3
+ export type Feature = "permissions";
4
+ export declare function supportsFeature(counterfactualInfo: StaticDecode<typeof TypeSerializedInitcode>, feature: Feature): boolean;
@@ -0,0 +1,21 @@
1
+ const supportedFeatures = {
2
+ "LightAccountV1.0.1": [],
3
+ "LightAccountV1.0.2": [],
4
+ "LightAccountV1.1.0": [],
5
+ "LightAccountV2.0.0": [],
6
+ "LightAccountV2.0.0-MultiOwner": [],
7
+ "MAv1.0.0-MultiOwner": [],
8
+ "MAv1.0.0-MultiSig": [],
9
+ "MAv2.0.0-sma-b": ["permissions"],
10
+ "MAv2.0.0-ma-ssv": ["permissions"],
11
+ "MAv2.0.0-ma-webauthn": [],
12
+ unknown: [],
13
+ };
14
+ export function supportsFeature(counterfactualInfo, feature) {
15
+ const factorySupportedFeatures = supportedFeatures[counterfactualInfo.factoryType];
16
+ if (factorySupportedFeatures === undefined) {
17
+ throw new Error("Unsupported FactoryType: " + counterfactualInfo.factoryType);
18
+ }
19
+ return factorySupportedFeatures.includes(feature);
20
+ }
21
+ //# sourceMappingURL=supportsFeature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supportsFeature.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/supportsFeature.ts"],"names":[],"mappings":"AAOA,MAAM,iBAAiB,GAAmC;IACxD,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,EAAE;IACxB,+BAA+B,EAAE,EAAE;IACnC,qBAAqB,EAAE,EAAE;IACzB,mBAAmB,EAAE,EAAE;IACvB,gBAAgB,EAAE,CAAC,aAAa,CAAC;IACjC,iBAAiB,EAAE,CAAC,aAAa,CAAC;IAClC,sBAAsB,EAAE,EAAE;IAC1B,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,MAAM,UAAU,eAAe,CAC7B,kBAA+D,EAC/D,OAAgB;IAEhB,MAAM,wBAAwB,GAC5B,iBAAiB,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACpD,IAAI,wBAAwB,KAAK,SAAS,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CACb,2BAA2B,GAAG,kBAAkB,CAAC,WAAW,CAC7D,CAAC;IACJ,CAAC;IACD,OAAO,wBAAwB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import type { StaticDecode } from \"@sinclair/typebox\";\nimport type { TypeSerializedInitcode } from \"../../schemas.ts\";\n\nexport type Feature = \"permissions\";\n\ntype FactoryType = StaticDecode<typeof TypeSerializedInitcode>[\"factoryType\"];\n\nconst supportedFeatures: Record<FactoryType, Feature[]> = {\n \"LightAccountV1.0.1\": [],\n \"LightAccountV1.0.2\": [],\n \"LightAccountV1.1.0\": [],\n \"LightAccountV2.0.0\": [],\n \"LightAccountV2.0.0-MultiOwner\": [],\n \"MAv1.0.0-MultiOwner\": [],\n \"MAv1.0.0-MultiSig\": [],\n \"MAv2.0.0-sma-b\": [\"permissions\"],\n \"MAv2.0.0-ma-ssv\": [\"permissions\"],\n \"MAv2.0.0-ma-webauthn\": [],\n unknown: [],\n};\n\nexport function supportsFeature(\n counterfactualInfo: StaticDecode<typeof TypeSerializedInitcode>,\n feature: Feature,\n): boolean {\n const factorySupportedFeatures =\n supportedFeatures[counterfactualInfo.factoryType];\n if (factorySupportedFeatures === undefined) {\n throw new Error(\n \"Unsupported FactoryType: \" + counterfactualInfo.factoryType,\n );\n }\n return factorySupportedFeatures.includes(feature);\n}\n"]}
@@ -287,6 +287,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
287
287
  data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
288
288
  raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
289
289
  }>]>;
290
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
290
291
  }>, import("@sinclair/typebox").TObject<{
291
292
  type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
292
293
  data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
@@ -322,6 +323,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
322
323
  [x: string]: unknown;
323
324
  };
324
325
  }>;
326
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
325
327
  }>]>;
326
328
  }>, import("@sinclair/typebox").TObject<{
327
329
  type: import("@sinclair/typebox").TLiteral<"user-operation-v070">;
@@ -347,6 +349,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
347
349
  data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
348
350
  raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
349
351
  }>]>;
352
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
350
353
  }>, import("@sinclair/typebox").TObject<{
351
354
  type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
352
355
  data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
@@ -382,6 +385,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
382
385
  [x: string]: unknown;
383
386
  };
384
387
  }>;
388
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
385
389
  }>]>;
386
390
  }>, import("@sinclair/typebox").TObject<{
387
391
  type: import("@sinclair/typebox").TLiteral<"authorization">;
@@ -392,6 +396,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
392
396
  chainId: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
393
397
  signatureRequest: import("@sinclair/typebox").TObject<{
394
398
  type: import("@sinclair/typebox").TLiteral<"eip7702Auth">;
399
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
395
400
  }>;
396
401
  }>]>>;
397
402
  }>, import("@sinclair/typebox").TObject<{
@@ -414,6 +419,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
414
419
  data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
415
420
  raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
416
421
  }>]>;
422
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
417
423
  }>, import("@sinclair/typebox").TObject<{
418
424
  type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
419
425
  data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
@@ -449,6 +455,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
449
455
  [x: string]: unknown;
450
456
  };
451
457
  }>;
458
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
452
459
  }>]>;
453
460
  }>, import("@sinclair/typebox").TObject<{
454
461
  type: import("@sinclair/typebox").TLiteral<"user-operation-v070">;
@@ -474,6 +481,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
474
481
  data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
475
482
  raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
476
483
  }>]>;
484
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
477
485
  }>, import("@sinclair/typebox").TObject<{
478
486
  type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
479
487
  data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
@@ -509,6 +517,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
509
517
  [x: string]: unknown;
510
518
  };
511
519
  }>;
520
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
512
521
  }>]>;
513
522
  }>]>;
514
523
  }>;
@@ -519,7 +528,7 @@ export declare const wallet_requestAccount: import("@sinclair/typebox").TObject<
519
528
  signerAddress: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
520
529
  id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
521
530
  creationHint: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
522
- accountType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<"sma-b">>;
531
+ accountType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"sma-b" | "la-v2" | "la-v1.0.1" | "la-v1.0.2" | "la-v1.1.0">[]>>;
523
532
  salt: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">>;
524
533
  }>, import("@sinclair/typebox").TObject<{
525
534
  accountType: import("@sinclair/typebox").TLiteral<"7702">;
@@ -548,7 +557,7 @@ export declare const wallet_createAccount: import("@sinclair/typebox").TObject<{
548
557
  signerAddress: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
549
558
  id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
550
559
  creationOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
551
- accountType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<"sma-b">>;
560
+ accountType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"sma-b" | "la-v2" | "la-v1.0.1" | "la-v1.0.2" | "la-v1.1.0">[]>>;
552
561
  salt: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">>;
553
562
  }>, import("@sinclair/typebox").TObject<{
554
563
  accountType: import("@sinclair/typebox").TLiteral<"7702">;
@@ -672,6 +681,7 @@ export declare const wallet_createSession: import("@sinclair/typebox").TObject<{
672
681
  [x: string]: unknown;
673
682
  };
674
683
  }>;
684
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
675
685
  }>;
676
686
  }>;
677
687
  }>;
@@ -87,11 +87,13 @@ export declare const WalletServerRpcSchema: {
87
87
  [x: string]: unknown;
88
88
  };
89
89
  };
90
+ rawPayload: `0x${string}`;
90
91
  } | {
91
92
  type: "personal_sign";
92
93
  data: string | {
93
94
  raw: `0x${string}`;
94
95
  };
96
+ rawPayload: `0x${string}`;
95
97
  };
96
98
  } | {
97
99
  type: "user-operation-v070";
@@ -133,11 +135,13 @@ export declare const WalletServerRpcSchema: {
133
135
  [x: string]: unknown;
134
136
  };
135
137
  };
138
+ rawPayload: `0x${string}`;
136
139
  } | {
137
140
  type: "personal_sign";
138
141
  data: string | {
139
142
  raw: `0x${string}`;
140
143
  };
144
+ rawPayload: `0x${string}`;
141
145
  };
142
146
  } | {
143
147
  type: "authorization";
@@ -148,6 +152,7 @@ export declare const WalletServerRpcSchema: {
148
152
  };
149
153
  signatureRequest: {
150
154
  type: "eip7702Auth";
155
+ rawPayload: `0x${string}`;
151
156
  };
152
157
  })[];
153
158
  } | {
@@ -186,11 +191,13 @@ export declare const WalletServerRpcSchema: {
186
191
  [x: string]: unknown;
187
192
  };
188
193
  };
194
+ rawPayload: `0x${string}`;
189
195
  } | {
190
196
  type: "personal_sign";
191
197
  data: string | {
192
198
  raw: `0x${string}`;
193
199
  };
200
+ rawPayload: `0x${string}`;
194
201
  };
195
202
  } | {
196
203
  type: "user-operation-v070";
@@ -232,11 +239,13 @@ export declare const WalletServerRpcSchema: {
232
239
  [x: string]: unknown;
233
240
  };
234
241
  };
242
+ rawPayload: `0x${string}`;
235
243
  } | {
236
244
  type: "personal_sign";
237
245
  data: string | {
238
246
  raw: `0x${string}`;
239
247
  };
248
+ rawPayload: `0x${string}`;
240
249
  };
241
250
  };
242
251
  } | {
@@ -460,7 +469,7 @@ export declare const WalletServerRpcSchema: {
460
469
  id?: string | undefined;
461
470
  creationOptions?: {
462
471
  salt?: `0x${string}` | undefined;
463
- accountType?: "sma-b" | undefined;
472
+ accountType?: "sma-b" | "la-v2" | "la-v1.0.1" | "la-v1.0.2" | "la-v1.1.0" | undefined;
464
473
  } | {
465
474
  accountType: "7702";
466
475
  } | undefined;
@@ -478,7 +487,7 @@ export declare const WalletServerRpcSchema: {
478
487
  id?: string | undefined;
479
488
  creationHint?: {
480
489
  salt?: `0x${string}` | undefined;
481
- accountType?: "sma-b" | undefined;
490
+ accountType?: "sma-b" | "la-v2" | "la-v1.0.1" | "la-v1.0.2" | "la-v1.1.0" | undefined;
482
491
  } | {
483
492
  accountType: "7702";
484
493
  } | undefined;
@@ -596,6 +605,7 @@ export declare const WalletServerRpcSchema: {
596
605
  [x: string]: unknown;
597
606
  };
598
607
  };
608
+ rawPayload: `0x${string}`;
599
609
  };
600
610
  sessionId: `0x${string}`;
601
611
  };
@@ -1,4 +1,8 @@
1
1
  import { type SchemaOptions, type Static } from "@sinclair/typebox";
2
+ export declare const baseAccountTypes: readonly ["sma-b", "la-v2", "la-v1.0.1", "la-v1.0.2", "la-v1.1.0"];
3
+ export type BaseAccountType = (typeof baseAccountTypes)[number];
4
+ export declare const accountTypes: readonly ["sma-b", "la-v2", "la-v1.0.1", "la-v1.0.2", "la-v1.1.0", "7702"];
5
+ export type AccountType = (typeof accountTypes)[number];
2
6
  export declare const TypeHex: (options?: SchemaOptions) => import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
3
7
  export declare const TypeAddress: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
4
8
  export declare const TypeUuid: import("@sinclair/typebox").TString;
@@ -141,7 +145,7 @@ export declare const TypeCounterfactualInfo: import("@sinclair/typebox").TInters
141
145
  }>]>]>;
142
146
  export type TypeCounterfactualInfo = Static<typeof TypeCounterfactualInfo>;
143
147
  export declare const TypeCreationOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
144
- accountType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<"sma-b">>;
148
+ accountType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"sma-b" | "la-v2" | "la-v1.0.1" | "la-v1.0.2" | "la-v1.1.0">[]>>;
145
149
  salt: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">>;
146
150
  }>, import("@sinclair/typebox").TObject<{
147
151
  accountType: import("@sinclair/typebox").TLiteral<"7702">;
@@ -193,6 +197,7 @@ export declare const TypePersonalSignSignatureRequest: import("@sinclair/typebox
193
197
  data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
194
198
  raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
195
199
  }>]>;
200
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
196
201
  }>;
197
202
  export declare const TypeTypedDataSignatureRequest: import("@sinclair/typebox").TObject<{
198
203
  type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
@@ -229,15 +234,18 @@ export declare const TypeTypedDataSignatureRequest: import("@sinclair/typebox").
229
234
  [x: string]: unknown;
230
235
  };
231
236
  }>;
237
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
232
238
  }>;
233
239
  export declare const TypeAuthorizationSignatureRequest: import("@sinclair/typebox").TObject<{
234
240
  type: import("@sinclair/typebox").TLiteral<"eip7702Auth">;
241
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
235
242
  }>;
236
243
  export declare const TypeSignatureRequest: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
237
244
  type: import("@sinclair/typebox").TLiteral<"personal_sign">;
238
245
  data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
239
246
  raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
240
247
  }>]>;
248
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
241
249
  }>, import("@sinclair/typebox").TObject<{
242
250
  type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
243
251
  data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
@@ -273,8 +281,10 @@ export declare const TypeSignatureRequest: import("@sinclair/typebox").TUnion<[i
273
281
  [x: string]: unknown;
274
282
  };
275
283
  }>;
284
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
276
285
  }>, import("@sinclair/typebox").TObject<{
277
286
  type: import("@sinclair/typebox").TLiteral<"eip7702Auth">;
287
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
278
288
  }>]>;
279
289
  export declare const TypeCallId: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, {
280
290
  chainId: `0x${string}`;
@@ -300,6 +310,7 @@ export declare const PreparedCall_UserOpV060: import("@sinclair/typebox").TObjec
300
310
  data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
301
311
  raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
302
312
  }>]>;
313
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
303
314
  }>, import("@sinclair/typebox").TObject<{
304
315
  type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
305
316
  data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
@@ -335,6 +346,7 @@ export declare const PreparedCall_UserOpV060: import("@sinclair/typebox").TObjec
335
346
  [x: string]: unknown;
336
347
  };
337
348
  }>;
349
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
338
350
  }>]>;
339
351
  }>;
340
352
  export declare const PreparedCall_UserOpV070: import("@sinclair/typebox").TObject<{
@@ -361,6 +373,7 @@ export declare const PreparedCall_UserOpV070: import("@sinclair/typebox").TObjec
361
373
  data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
362
374
  raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
363
375
  }>]>;
376
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
364
377
  }>, import("@sinclair/typebox").TObject<{
365
378
  type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
366
379
  data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
@@ -396,6 +409,7 @@ export declare const PreparedCall_UserOpV070: import("@sinclair/typebox").TObjec
396
409
  [x: string]: unknown;
397
410
  };
398
411
  }>;
412
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
399
413
  }>]>;
400
414
  }>;
401
415
  export declare const PreparedCall_Authorization: import("@sinclair/typebox").TObject<{
@@ -407,6 +421,7 @@ export declare const PreparedCall_Authorization: import("@sinclair/typebox").TOb
407
421
  chainId: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
408
422
  signatureRequest: import("@sinclair/typebox").TObject<{
409
423
  type: import("@sinclair/typebox").TLiteral<"eip7702Auth">;
424
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
410
425
  }>;
411
426
  }>;
412
427
  export declare const TypeEdcsaSigData: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
@@ -5,6 +5,14 @@ const UUID_V4_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[
5
5
  FormatRegistry.Set("uuid", (value) => UUID_V4_REGEX.test(value));
6
6
  const BASE_64_URL_REGEX = /^[A-Za-z0-9_-]+$/; // Matches base64url encoded strings (without padding)
7
7
  FormatRegistry.Set("base64url", (value) => BASE_64_URL_REGEX.test(value));
8
+ export const baseAccountTypes = [
9
+ "sma-b",
10
+ "la-v2",
11
+ "la-v1.0.1",
12
+ "la-v1.0.2",
13
+ "la-v1.1.0",
14
+ ];
15
+ export const accountTypes = [...baseAccountTypes, "7702"];
8
16
  export const TypeHex = (options) => Type.TemplateLiteral("0x${string}", {
9
17
  ...options,
10
18
  });
@@ -207,7 +215,7 @@ export const TypeCounterfactualInfo = Type.Intersect([
207
215
  export const TypeCreationOptions = Type.Optional(Type.Union([
208
216
  Type.Object({
209
217
  // Optional b/c `sma-b` is the default if no accountType is specified.
210
- accountType: Type.Optional(Type.Literal("sma-b")),
218
+ accountType: Type.Optional(Type.Union(baseAccountTypes.map((lit) => Type.Literal(lit)))),
211
219
  salt: Type.Optional(TypeHex()),
212
220
  }, {
213
221
  description: "SMA-B account type",
@@ -271,15 +279,18 @@ export const TypePersonalSignSignatureRequest = Type.Object({
271
279
  raw: TypeHex(),
272
280
  }, { description: "Raw message" }),
273
281
  ]),
282
+ rawPayload: TypeHex(),
274
283
  }, { description: "Personal sign" });
275
284
  export const TypeTypedDataSignatureRequest = Type.Object({
276
285
  type: Type.Literal("eth_signTypedData_v4"),
277
286
  data: TTypedDataDefinition,
287
+ rawPayload: TypeHex(),
278
288
  }, {
279
289
  description: "Typed data",
280
290
  });
281
291
  export const TypeAuthorizationSignatureRequest = Type.Object({
282
292
  type: Type.Literal("eip7702Auth"),
293
+ rawPayload: TypeHex(),
283
294
  });
284
295
  export const TypeSignatureRequest = Type.Union([
285
296
  TypePersonalSignSignatureRequest,