@account-kit/wallet-client 0.1.0-alpha.10 → 0.1.0-alpha.12

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 (146) hide show
  1. package/dist/esm/client/actions/getCallsStatus.d.ts +4 -3
  2. package/dist/esm/client/actions/getCallsStatus.js +1 -0
  3. package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
  4. package/dist/esm/client/actions/grantPermissions.d.ts +5 -4
  5. package/dist/esm/client/actions/grantPermissions.js +21 -5
  6. package/dist/esm/client/actions/grantPermissions.js.map +1 -1
  7. package/dist/esm/client/actions/prepareCalls.d.ts +4 -3
  8. package/dist/esm/client/actions/prepareCalls.js +1 -0
  9. package/dist/esm/client/actions/prepareCalls.js.map +1 -1
  10. package/dist/esm/client/actions/prepareSign.d.ts +4 -3
  11. package/dist/esm/client/actions/prepareSign.js +1 -0
  12. package/dist/esm/client/actions/prepareSign.js.map +1 -1
  13. package/dist/esm/client/actions/requestAccount.js +3 -3
  14. package/dist/esm/client/actions/requestAccount.js.map +1 -1
  15. package/dist/esm/client/actions/signSignatureRequest.d.ts +3 -3
  16. package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
  17. package/dist/esm/client/client.e2e-test.js +190 -329
  18. package/dist/esm/client/client.e2e-test.js.map +1 -1
  19. package/dist/esm/client/index.d.ts +1 -4
  20. package/dist/esm/client/index.js +13 -18
  21. package/dist/esm/client/index.js.map +1 -1
  22. package/dist/esm/{isomorphic/utils/createAccount.d.ts → internal/account.d.ts} +3 -7
  23. package/dist/esm/{isomorphic/utils/createAccount.js → internal/account.js} +9 -33
  24. package/dist/esm/internal/account.js.map +1 -0
  25. package/dist/esm/types.d.ts +2 -8
  26. package/dist/esm/types.js.map +1 -1
  27. package/dist/types/client/actions/getCallsStatus.d.ts +4 -3
  28. package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
  29. package/dist/types/client/actions/grantPermissions.d.ts +5 -4
  30. package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
  31. package/dist/types/client/actions/prepareCalls.d.ts +4 -3
  32. package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
  33. package/dist/types/client/actions/prepareSign.d.ts +4 -3
  34. package/dist/types/client/actions/prepareSign.d.ts.map +1 -1
  35. package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
  36. package/dist/types/client/actions/signSignatureRequest.d.ts +3 -3
  37. package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
  38. package/dist/types/client/index.d.ts +1 -4
  39. package/dist/types/client/index.d.ts.map +1 -1
  40. package/dist/types/{isomorphic/utils/createAccount.d.ts → internal/account.d.ts} +4 -8
  41. package/dist/types/internal/account.d.ts.map +1 -0
  42. package/dist/types/types.d.ts +2 -8
  43. package/dist/types/types.d.ts.map +1 -1
  44. package/package.json +3 -8
  45. package/src/client/actions/getCallsStatus.ts +8 -6
  46. package/src/client/actions/grantPermissions.ts +41 -10
  47. package/src/client/actions/prepareCalls.ts +11 -6
  48. package/src/client/actions/prepareSign.ts +9 -6
  49. package/src/client/actions/requestAccount.ts +3 -3
  50. package/src/client/actions/signSignatureRequest.ts +8 -8
  51. package/src/client/client.e2e-test.ts +143 -298
  52. package/src/client/index.ts +22 -23
  53. package/src/{isomorphic/utils/createAccount.ts → internal/account.ts} +11 -51
  54. package/src/types.ts +4 -15
  55. package/dist/esm/exports/internal.d.ts +0 -4
  56. package/dist/esm/exports/internal.js +0 -3
  57. package/dist/esm/exports/internal.js.map +0 -1
  58. package/dist/esm/isomorphic/actions/createSession.d.ts +0 -13
  59. package/dist/esm/isomorphic/actions/createSession.js +0 -94
  60. package/dist/esm/isomorphic/actions/createSession.js.map +0 -1
  61. package/dist/esm/isomorphic/actions/formatSign.d.ts +0 -8
  62. package/dist/esm/isomorphic/actions/formatSign.js +0 -42
  63. package/dist/esm/isomorphic/actions/formatSign.js.map +0 -1
  64. package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +0 -7
  65. package/dist/esm/isomorphic/actions/getCallsStatus.js +0 -71
  66. package/dist/esm/isomorphic/actions/getCallsStatus.js.map +0 -1
  67. package/dist/esm/isomorphic/actions/prepareCalls.d.ts +0 -7
  68. package/dist/esm/isomorphic/actions/prepareCalls.js +0 -116
  69. package/dist/esm/isomorphic/actions/prepareCalls.js.map +0 -1
  70. package/dist/esm/isomorphic/actions/prepareSign.d.ts +0 -7
  71. package/dist/esm/isomorphic/actions/prepareSign.js +0 -49
  72. package/dist/esm/isomorphic/actions/prepareSign.js.map +0 -1
  73. package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +0 -7
  74. package/dist/esm/isomorphic/actions/sendPreparedCalls.js +0 -156
  75. package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +0 -1
  76. package/dist/esm/isomorphic/client.d.ts +0 -275
  77. package/dist/esm/isomorphic/client.js +0 -41
  78. package/dist/esm/isomorphic/client.js.map +0 -1
  79. package/dist/esm/isomorphic/utils/7702.d.ts +0 -19
  80. package/dist/esm/isomorphic/utils/7702.js +0 -70
  81. package/dist/esm/isomorphic/utils/7702.js.map +0 -1
  82. package/dist/esm/isomorphic/utils/createAccount.js.map +0 -1
  83. package/dist/esm/isomorphic/utils/createDummySigner.d.ts +0 -3
  84. package/dist/esm/isomorphic/utils/createDummySigner.js +0 -17
  85. package/dist/esm/isomorphic/utils/createDummySigner.js.map +0 -1
  86. package/dist/esm/isomorphic/utils/decodeSignature.d.ts +0 -3
  87. package/dist/esm/isomorphic/utils/decodeSignature.js +0 -15
  88. package/dist/esm/isomorphic/utils/decodeSignature.js.map +0 -1
  89. package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +0 -21
  90. package/dist/esm/isomorphic/utils/parsePermissionsContext.js +0 -34
  91. package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +0 -1
  92. package/dist/esm/isomorphic/utils/supportsFeature.d.ts +0 -4
  93. package/dist/esm/isomorphic/utils/supportsFeature.js +0 -21
  94. package/dist/esm/isomorphic/utils/supportsFeature.js.map +0 -1
  95. package/dist/esm/local/client.d.ts +0 -3
  96. package/dist/esm/local/client.js +0 -97
  97. package/dist/esm/local/client.js.map +0 -1
  98. package/dist/esm/remote/client.d.ts +0 -9
  99. package/dist/esm/remote/client.js +0 -41
  100. package/dist/esm/remote/client.js.map +0 -1
  101. package/dist/types/exports/internal.d.ts +0 -5
  102. package/dist/types/exports/internal.d.ts.map +0 -1
  103. package/dist/types/isomorphic/actions/createSession.d.ts +0 -14
  104. package/dist/types/isomorphic/actions/createSession.d.ts.map +0 -1
  105. package/dist/types/isomorphic/actions/formatSign.d.ts +0 -9
  106. package/dist/types/isomorphic/actions/formatSign.d.ts.map +0 -1
  107. package/dist/types/isomorphic/actions/getCallsStatus.d.ts +0 -8
  108. package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +0 -1
  109. package/dist/types/isomorphic/actions/prepareCalls.d.ts +0 -8
  110. package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +0 -1
  111. package/dist/types/isomorphic/actions/prepareSign.d.ts +0 -8
  112. package/dist/types/isomorphic/actions/prepareSign.d.ts.map +0 -1
  113. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +0 -8
  114. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +0 -1
  115. package/dist/types/isomorphic/client.d.ts +0 -276
  116. package/dist/types/isomorphic/client.d.ts.map +0 -1
  117. package/dist/types/isomorphic/utils/7702.d.ts +0 -20
  118. package/dist/types/isomorphic/utils/7702.d.ts.map +0 -1
  119. package/dist/types/isomorphic/utils/createAccount.d.ts.map +0 -1
  120. package/dist/types/isomorphic/utils/createDummySigner.d.ts +0 -4
  121. package/dist/types/isomorphic/utils/createDummySigner.d.ts.map +0 -1
  122. package/dist/types/isomorphic/utils/decodeSignature.d.ts +0 -4
  123. package/dist/types/isomorphic/utils/decodeSignature.d.ts.map +0 -1
  124. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +0 -22
  125. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +0 -1
  126. package/dist/types/isomorphic/utils/supportsFeature.d.ts +0 -5
  127. package/dist/types/isomorphic/utils/supportsFeature.d.ts.map +0 -1
  128. package/dist/types/local/client.d.ts +0 -4
  129. package/dist/types/local/client.d.ts.map +0 -1
  130. package/dist/types/remote/client.d.ts +0 -10
  131. package/dist/types/remote/client.d.ts.map +0 -1
  132. package/src/exports/internal.ts +0 -8
  133. package/src/isomorphic/actions/createSession.ts +0 -163
  134. package/src/isomorphic/actions/formatSign.ts +0 -76
  135. package/src/isomorphic/actions/getCallsStatus.ts +0 -112
  136. package/src/isomorphic/actions/prepareCalls.ts +0 -172
  137. package/src/isomorphic/actions/prepareSign.ts +0 -91
  138. package/src/isomorphic/actions/sendPreparedCalls.ts +0 -234
  139. package/src/isomorphic/client.ts +0 -102
  140. package/src/isomorphic/utils/7702.ts +0 -135
  141. package/src/isomorphic/utils/createDummySigner.ts +0 -27
  142. package/src/isomorphic/utils/decodeSignature.ts +0 -21
  143. package/src/isomorphic/utils/parsePermissionsContext.ts +0 -51
  144. package/src/isomorphic/utils/supportsFeature.ts +0 -34
  145. package/src/local/client.ts +0 -136
  146. package/src/remote/client.ts +0 -67
@@ -1,70 +0,0 @@
1
- import { concatHex, numberToHex, isAddress, hexToNumber, } from "viem";
2
- import { Eip7702AccountTypeToDelegationAddress, SUPPORTED_DELEGATION_ADDRESSES, } from "@alchemy/wallet-api-types/capabilities";
3
- import { InvalidRequestError } from "ox/RpcResponse";
4
- import { hashAuthorization } from "viem/utils";
5
- /** Checks if an address is actively delegated on-chain. */
6
- export const isDelegated = async (client, params) => {
7
- const expectedCode = concatHex(["0xef0100", params.delegation]);
8
- const code = (await client.getCode({ address: params.address })) ?? "0x";
9
- return code.toLowerCase() === expectedCode.toLowerCase();
10
- };
11
- export const createAuthorizationRequest = async (client, params) => {
12
- const data = {
13
- address: params.delegation,
14
- nonce: numberToHex(await client.getTransactionCount({
15
- address: params.address,
16
- })),
17
- };
18
- return {
19
- type: "authorization",
20
- data,
21
- chainId: numberToHex(client.chain.id),
22
- signatureRequest: {
23
- type: "eip7702Auth",
24
- rawPayload: hashAuthorization({
25
- chainId: client.chain.id,
26
- nonce: hexToNumber(data.nonce),
27
- address: params.delegation,
28
- }),
29
- },
30
- };
31
- };
32
- export const DelegationAddressToAccountType = Object.fromEntries(Object.entries(Eip7702AccountTypeToDelegationAddress).map(([key, value]) => [
33
- value,
34
- key,
35
- ]));
36
- export const isSupportedDelegationAddress7702 = (address) => {
37
- return SUPPORTED_DELEGATION_ADDRESSES.includes(address);
38
- };
39
- export const getAccountTypeForDelegationAddress7702 = (address) => {
40
- return DelegationAddressToAccountType[address];
41
- };
42
- const getDelegationAddressForAccountType7702 = (accountType) => {
43
- return Eip7702AccountTypeToDelegationAddress[accountType];
44
- };
45
- const DEFAULT_7702_DELEGATION_ADDR = Eip7702AccountTypeToDelegationAddress["ModularAccountV2"];
46
- export const parseDelegation = (eip7702AuthCapability) => {
47
- return eip7702AuthCapability === true
48
- ? DEFAULT_7702_DELEGATION_ADDR
49
- : isAddress(eip7702AuthCapability.delegation)
50
- ? eip7702AuthCapability.delegation
51
- : getDelegationAddressForAccountType7702(eip7702AuthCapability.delegation);
52
- };
53
- export const assertValid7702AccountAddress = (fromAddress, eip7702AuthCapability) => {
54
- if (eip7702AuthCapability) {
55
- if (typeof eip7702AuthCapability === "object" &&
56
- "account" in eip7702AuthCapability &&
57
- eip7702AuthCapability?.account !== fromAddress) {
58
- throw new InvalidRequestError({
59
- message: `EIP-7702 delegation account ${eip7702AuthCapability.account} must match 'from' address ${fromAddress}.`,
60
- });
61
- }
62
- const delegation = parseDelegation(eip7702AuthCapability);
63
- if (!isSupportedDelegationAddress7702(delegation)) {
64
- throw new InvalidRequestError({
65
- message: `Unsupported 7702 delegation address: ${delegation}`,
66
- });
67
- }
68
- }
69
- };
70
- //# sourceMappingURL=7702.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"7702.js","sourceRoot":"","sources":["../../../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KAAK,QAAQ;YACzC,SAAS,IAAI,qBAAqB;YAClC,qBAAqB,EAAE,OAAO,KAAK,WAAW,EAC9C,CAAC;YACD,MAAM,IAAI,mBAAmB,CAAC;gBAC5B,OAAO,EAAE,+BAA+B,qBAAqB,CAAC,OAAO,8BAA8B,WAAW,GAAG;aAClH,CAAC,CAAC;QACL,CAAC;QAED,MAAM,UAAU,GAAG,eAAe,CAAC,qBAAqB,CAAC,CAAC;QAE1D,IAAI,CAAC,gCAAgC,CAAC,UAAU,CAAC,EAAE,CAAC;YAClD,MAAM,IAAI,mBAAmB,CAAC;gBAC5B,OAAO,EAAE,wCAAwC,UAAU,EAAE;aAC9D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { SmartAccountClient, SmartContractAccount } from \"@aa-sdk/core\";\nimport {\n concatHex,\n numberToHex,\n type Address,\n type Chain,\n type Transport,\n isAddress,\n hexToNumber,\n} from \"viem\";\nimport type { WalletServerViemRpcSchema } from \"@alchemy/wallet-api-types/rpc\";\nimport {\n Eip7702AccountTypeToDelegationAddress,\n SUPPORTED_DELEGATION_ADDRESSES,\n type Supported7702AccountType,\n type Eip7702AuthCapability,\n} from \"@alchemy/wallet-api-types/capabilities\";\nimport type { PreparedCall_Authorization } from \"@alchemy/wallet-api-types\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { hashAuthorization } from \"viem/utils\";\n\n/** Checks if an address is actively delegated on-chain. */\nexport const isDelegated = async (\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: { address: Address; delegation: Address },\n): Promise<boolean> => {\n const expectedCode = concatHex([\"0xef0100\", params.delegation]);\n const code = (await client.getCode({ address: params.address })) ?? \"0x\";\n return code.toLowerCase() === expectedCode.toLowerCase();\n};\n\nexport const createAuthorizationRequest = async (\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: { address: Address; delegation: Address },\n): Promise<PreparedCall_Authorization> => {\n const data = {\n address: params.delegation,\n nonce: numberToHex(\n await client.getTransactionCount({\n address: params.address,\n }),\n ),\n };\n return {\n type: \"authorization\" as const,\n data,\n chainId: numberToHex(client.chain.id),\n signatureRequest: {\n type: \"eip7702Auth\" as const,\n rawPayload: hashAuthorization({\n chainId: client.chain.id,\n nonce: hexToNumber(data.nonce),\n address: params.delegation,\n }),\n },\n };\n};\n\nexport const DelegationAddressToAccountType: Record<\n Address,\n Supported7702AccountType\n> = Object.fromEntries(\n Object.entries(Eip7702AccountTypeToDelegationAddress).map(([key, value]) => [\n value,\n key,\n ]),\n) as Record<Address, Supported7702AccountType>;\n\nexport const isSupportedDelegationAddress7702 = (address: Address): boolean => {\n return (SUPPORTED_DELEGATION_ADDRESSES as Address[]).includes(address);\n};\n\nexport const getAccountTypeForDelegationAddress7702 = (\n address: Address,\n): Supported7702AccountType | undefined => {\n return DelegationAddressToAccountType[address];\n};\n\nconst getDelegationAddressForAccountType7702 = (\n accountType: Supported7702AccountType,\n): (typeof SUPPORTED_DELEGATION_ADDRESSES)[number] => {\n return Eip7702AccountTypeToDelegationAddress[accountType];\n};\n\nconst DEFAULT_7702_DELEGATION_ADDR =\n Eip7702AccountTypeToDelegationAddress[\"ModularAccountV2\"];\n\nexport const parseDelegation = (\n eip7702AuthCapability: Eip7702AuthCapability,\n) => {\n return eip7702AuthCapability === true\n ? DEFAULT_7702_DELEGATION_ADDR\n : isAddress(eip7702AuthCapability.delegation)\n ? eip7702AuthCapability.delegation\n : getDelegationAddressForAccountType7702(\n eip7702AuthCapability.delegation,\n );\n};\n\nexport const assertValid7702AccountAddress = (\n fromAddress: Address,\n eip7702AuthCapability: Eip7702AuthCapability | undefined,\n) => {\n if (eip7702AuthCapability) {\n if (\n typeof eip7702AuthCapability === \"object\" &&\n \"account\" in eip7702AuthCapability &&\n eip7702AuthCapability?.account !== fromAddress\n ) {\n throw new InvalidRequestError({\n message: `EIP-7702 delegation account ${eip7702AuthCapability.account} must match 'from' address ${fromAddress}.`,\n });\n }\n\n const delegation = parseDelegation(eip7702AuthCapability);\n\n if (!isSupportedDelegationAddress7702(delegation)) {\n throw new InvalidRequestError({\n message: `Unsupported 7702 delegation address: ${delegation}`,\n });\n }\n }\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createAccount.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,4BAA4B,EAC5B,8BAA8B,GAE/B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,sCAAsC,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAYpE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA2B;IAE3B,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,CAAC;IAE5D,2EAA2E;IAC3E,sDAAsD;IACtD,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,kBAA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AAO,EAAE,QAAQ;aAClB,CAAC,CAAC;QACL,KAAK,oBAAoB;YACvB,OAAO,kBAAkB,CAAC;gBACxB,GAAG,YAAY;gBACf,OAAO,EAAE,QAAQ;aAClB,CAAC,CAAC;QACL,KAAK,oBAAoB;YACvB,OAAO,kBAAkB,CAAC;gBACxB,GAAG,YAAY;gBACf,OAAO,EAAE,QAAQ;aAClB,CAAC,CAAC;QACL,KAAK,oBAAoB;YACvB,OAAO,kBAAkB,CAAC;gBACxB,GAAG,YAAY;gBACf,OAAO,EAAE,QAAQ;aAClB,CAAC,CAAC;QACL,KAAK,qBAAqB;YACxB,OAAO,8BAA8B,CAAC;gBACpC,GAAG,YAAY;aAChB,CAAC,CAAC;QACL,KAAK,+BAA+B;YAClC,OAAO,4BAA4B,CAAC;gBAClC,GAAG,YAAY;gBACf,OAAO,EAAE,QAAQ;aAClB,CAAC,CAAC;QACL,KAAK,mBAAmB,CAAC;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 createMultiOwnerLightAccount,\n createMultiOwnerModularAccount,\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 { parsePermissionsContext } from \"./parsePermissionsContext.js\";\nimport { assertNever } from \"../../utils.js\";\nimport { getAccountTypeForDelegationAddress7702 } from \"./7702.js\";\nimport { TypeSerializedInitcode } from \"@alchemy/wallet-api-types\";\nimport { PermissionsCapability } from \"@alchemy/wallet-api-types/capabilities\";\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 \"MAv1.0.0-MultiOwner\":\n return createMultiOwnerModularAccount({\n ...commonParams,\n });\n case \"LightAccountV2.0.0-MultiOwner\":\n return createMultiOwnerLightAccount({\n ...commonParams,\n version: \"v2.0.0\",\n });\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"]}
@@ -1,3 +0,0 @@
1
- import { type SmartAccountSigner } from "@aa-sdk/core";
2
- import { type Address } from "viem";
3
- export declare const createDummySigner: (address: Address) => SmartAccountSigner;
@@ -1,17 +0,0 @@
1
- import {} from "@aa-sdk/core";
2
- import { BaseError, } from "viem";
3
- export const createDummySigner = (address) => ({
4
- signerType: "",
5
- inner: undefined,
6
- getAddress: async function () {
7
- return address;
8
- },
9
- // Not supported on the server
10
- signMessage: function (_message) {
11
- throw new BaseError("signMessage not implemented by dummy signer.");
12
- },
13
- signTypedData: function (_params) {
14
- throw new BaseError("signTypedData not implemented by dummy signer.");
15
- },
16
- });
17
- //# sourceMappingURL=createDummySigner.js.map
@@ -1 +0,0 @@
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,3 +0,0 @@
1
- import type { StaticDecode } from "@sinclair/typebox";
2
- import { TypeEcdsaSig, type TypeEcdsaSig as TypeEcdsaSigType } from "@alchemy/wallet-api-types";
3
- export declare const decodeSignature: (signature: TypeEcdsaSigType["signature"]) => StaticDecode<typeof TypeEcdsaSig>["signature"];
@@ -1,15 +0,0 @@
1
- import { Value } from "@sinclair/typebox/value";
2
- import { TypeEcdsaSig, } from "@alchemy/wallet-api-types";
3
- import { assertNever } from "../../utils.js";
4
- export const decodeSignature = (signature) => {
5
- switch (signature.type) {
6
- case "ecdsa":
7
- case "secp256k1":
8
- return Value.Decode(TypeEcdsaSig, {
9
- signature,
10
- }).signature;
11
- default:
12
- return assertNever(signature, "Unexpected signature type");
13
- }
14
- };
15
- //# sourceMappingURL=decodeSignature.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decodeSignature.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/decodeSignature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EACL,YAAY,GAEb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,SAAwC,EACQ,EAAE;IAClD,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,OAAO,CAAC;QACb,KAAK,WAAW;YACd,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE;gBAChC,SAAS;aACiB,CAAC,CAAC,SAAS,CAAC;QAC1C;YACE,OAAO,WAAW,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { Value } from \"@sinclair/typebox/value\";\nimport type { StaticDecode } from \"@sinclair/typebox\";\nimport {\n TypeEcdsaSig,\n type TypeEcdsaSig as TypeEcdsaSigType,\n} from \"@alchemy/wallet-api-types\";\nimport { assertNever } from \"../../utils.js\";\n\nexport const decodeSignature = (\n signature: TypeEcdsaSigType[\"signature\"],\n): StaticDecode<typeof TypeEcdsaSig>[\"signature\"] => {\n switch (signature.type) {\n case \"ecdsa\":\n case \"secp256k1\":\n return Value.Decode(TypeEcdsaSig, {\n signature,\n } satisfies TypeEcdsaSigType).signature;\n default:\n return assertNever(signature, \"Unexpected signature type\");\n }\n};\n"]}
@@ -1,21 +0,0 @@
1
- import type { StaticDecode } from "@sinclair/typebox";
2
- import type { Address } from "viem";
3
- import { PermissionsCapability } from "@alchemy/wallet-api-types/capabilities";
4
- import { TypeSerializedInitcode } from "@alchemy/wallet-api-types";
5
- export declare function parsePermissionsContext(permissions?: StaticDecode<typeof PermissionsCapability>, parsedCi?: StaticDecode<typeof TypeSerializedInitcode> | undefined, delegation7702?: Address): ({
6
- contextVersion: keyof typeof import("@alchemy/wallet-api-types/capabilities").PermissionsContextVersion;
7
- } & {
8
- contextVersion: "LOCAL_MODE_DEFERRED_ACTION";
9
- deferredAction: import("viem").Hex;
10
- sessionId?: never;
11
- signature?: never;
12
- }) | ({
13
- contextVersion: keyof typeof import("@alchemy/wallet-api-types/capabilities").PermissionsContextVersion;
14
- } & {
15
- contextVersion: "NON_DEFERRED_ACTION";
16
- deferredAction?: never;
17
- sessionId?: never;
18
- signature?: never;
19
- entityId: import("viem").Hex;
20
- isGlobalValidation: boolean;
21
- }) | undefined;
@@ -1,34 +0,0 @@
1
- import { InvalidRequestError } from "ox/RpcResponse";
2
- import { getAccountTypeForDelegationAddress7702 } from "./7702.js";
3
- import { decodePermissionsContext, PermissionsCapability, } from "@alchemy/wallet-api-types/capabilities";
4
- import { TypeSerializedInitcode } from "@alchemy/wallet-api-types";
5
- export function parsePermissionsContext(permissions, parsedCi, delegation7702) {
6
- if (!permissions) {
7
- return undefined;
8
- }
9
- if ("sessionId" in permissions) {
10
- throw new InvalidRequestError({
11
- message: "Remote permissions are not supported in isomorphic client",
12
- });
13
- }
14
- if (!("context" in permissions)) {
15
- return undefined;
16
- }
17
- const isMAV2 = (parsedCi && parsedCi.factoryType === "MAv2.0.0-sma-b") ||
18
- (delegation7702 &&
19
- getAccountTypeForDelegationAddress7702(delegation7702) ===
20
- "ModularAccountV2");
21
- if (!isMAV2) {
22
- throw new InvalidRequestError({
23
- message: "Permissions are currently only supported by MAv2 accounts",
24
- });
25
- }
26
- const context = decodePermissionsContext(permissions);
27
- if (context?.contextVersion === "REMOTE_MODE_DEFERRED_ACTION") {
28
- throw new InvalidRequestError({
29
- message: "Remote mode deferred action not supported in isomorphic client",
30
- });
31
- }
32
- return context;
33
- }
34
- //# sourceMappingURL=parsePermissionsContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parsePermissionsContext.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/parsePermissionsContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,sCAAsC,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,UAAU,uBAAuB,CACrC,WAAwD,EACxD,QAAkE,EAClE,cAAwB;IAExB,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,WAAW,IAAI,WAAW,EAAE,CAAC;QAC/B,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,2DAA2D;SACrE,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,CAAC,SAAS,IAAI,WAAW,CAAC,EAAE,CAAC;QAChC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GACV,CAAC,QAAQ,IAAI,QAAQ,CAAC,WAAW,KAAK,gBAAgB,CAAC;QACvD,CAAC,cAAc;YACb,sCAAsC,CAAC,cAAc,CAAC;gBACpD,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,WAAW,CAAC,CAAC;IAEtD,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 type { Address } from \"viem\";\nimport { getAccountTypeForDelegationAddress7702 } from \"./7702.js\";\nimport {\n decodePermissionsContext,\n PermissionsCapability,\n} from \"@alchemy/wallet-api-types/capabilities\";\nimport { TypeSerializedInitcode } from \"@alchemy/wallet-api-types\";\n\nexport function parsePermissionsContext(\n permissions?: StaticDecode<typeof PermissionsCapability>,\n parsedCi?: StaticDecode<typeof TypeSerializedInitcode> | undefined,\n delegation7702?: Address,\n) {\n if (!permissions) {\n return undefined;\n }\n\n if (\"sessionId\" in permissions) {\n throw new InvalidRequestError({\n message: \"Remote permissions are not supported in isomorphic client\",\n });\n }\n\n if (!(\"context\" in permissions)) {\n return undefined;\n }\n\n const isMAV2 =\n (parsedCi && parsedCi.factoryType === \"MAv2.0.0-sma-b\") ||\n (delegation7702 &&\n getAccountTypeForDelegationAddress7702(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(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"]}
@@ -1,4 +0,0 @@
1
- import type { StaticDecode } from "@sinclair/typebox";
2
- import type { TypeSerializedInitcode } from "@alchemy/wallet-api-types";
3
- export type Feature = "permissions";
4
- export declare function supportsFeature(counterfactualInfo: StaticDecode<typeof TypeSerializedInitcode>, feature: Feature): boolean;
@@ -1,21 +0,0 @@
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
@@ -1 +0,0 @@
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 \"@alchemy/wallet-api-types\";\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"]}
@@ -1,3 +0,0 @@
1
- import { type Address } from "viem";
2
- import type { CreateInnerClientParams, InnerWalletApiClient } from "../types.ts";
3
- export declare function createLocalClient<TAccount extends Address | undefined = Address | undefined>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient;
@@ -1,97 +0,0 @@
1
- import { split } from "@aa-sdk/core";
2
- import { buildDeferredActionDigest } from "@account-kit/smart-contracts/experimental";
3
- import { createClient, custom } from "viem";
4
- import { encodePermissionsContext, prefixSignatureKeyType, } from "@alchemy/wallet-api-types/capabilities";
5
- import { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
6
- import { internalStateDecorator } from "../internal/decorator.js";
7
- import { createIsomorphicClient, } from "../isomorphic/client.js";
8
- import { assertNever } from "../utils.js";
9
- const localMethods = [
10
- "wallet_prepareCalls",
11
- "wallet_sendPreparedCalls",
12
- "wallet_getCallsStatus",
13
- "wallet_createSession",
14
- ];
15
- export function createLocalClient(params) {
16
- const { chain, transport, policyId, account } = params;
17
- const isomorphicClient = createIsomorphicClient({
18
- transport,
19
- chain,
20
- policyId,
21
- useErc7677middleware: false,
22
- });
23
- const clientMap = {
24
- [policyId ?? "default"]: isomorphicClient,
25
- };
26
- const innerTransport = split({
27
- overrides: [
28
- {
29
- methods: localMethods,
30
- transport: custom({
31
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
- async request(args) {
33
- switch (args.method) {
34
- case "wallet_prepareCalls": {
35
- const params = args.params[0];
36
- const capabilityPolicyId = params.capabilities?.paymasterService?.policyId;
37
- if (capabilityPolicyId != null &&
38
- policyId !== capabilityPolicyId &&
39
- !clientMap[capabilityPolicyId]) {
40
- clientMap[capabilityPolicyId] = createIsomorphicClient({
41
- transport,
42
- chain,
43
- policyId: capabilityPolicyId,
44
- });
45
- }
46
- const client = clientMap[capabilityPolicyId ?? policyId ?? "default"];
47
- return client.prepareCalls(params);
48
- }
49
- case "wallet_sendPreparedCalls":
50
- return isomorphicClient.sendPreparedCalls(args.params[0]);
51
- case "wallet_getCallsStatus":
52
- return isomorphicClient.getCallsStatus(args.params[0]);
53
- case "wallet_createSession": {
54
- return isomorphicClient.createSession(args.params[0]);
55
- }
56
- default:
57
- return assertNever(args.method, `Unexpected method: ${args.method}`);
58
- }
59
- },
60
- }, {
61
- retryCount: 0,
62
- }),
63
- },
64
- ],
65
- fallback: transport,
66
- });
67
- return createClient({
68
- transport: innerTransport,
69
- chain,
70
- account,
71
- })
72
- .extend(() => ({
73
- policyId,
74
- ...innerClientActions(isomorphicClient),
75
- }))
76
- .extend(() => ({
77
- internal: internalStateDecorator(),
78
- }));
79
- }
80
- const innerClientActions = (isomorphicClient) => {
81
- return {
82
- grantPermissions: async (signer, params) => {
83
- const { signatureRequest, fullPreSignatureDeferredActionDigest } = await isomorphicClient.createSession(params);
84
- const signature = await signSignatureRequest(signer, signatureRequest);
85
- return {
86
- context: encodePermissionsContext({
87
- contextVersion: "LOCAL_MODE_DEFERRED_ACTION",
88
- deferredAction: buildDeferredActionDigest({
89
- fullPreSignatureDeferredActionDigest,
90
- sig: prefixSignatureKeyType(signature.data, signature.type),
91
- }),
92
- }),
93
- };
94
- },
95
- };
96
- };
97
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
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,EAAgB,MAAM,MAAM,CAAC;AAC1D,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,wCAAwC,CAAC;AAChD,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;AAO9B,MAAM,UAAU,iBAAiB,CAC/B,MAA+B;IAE/B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACvD,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;QAC9C,SAAS;QACT,KAAK;QACL,QAAQ;QACR,oB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"@account-kit/smart-contracts/experimental\";\nimport { createClient, custom, type Address } from \"viem\";\nimport {\n encodePermissionsContext,\n prefixSignatureKeyType,\n} from \"@alchemy/wallet-api-types/capabilities\";\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 Address | undefined = Address | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient;\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 signature = await signSignatureRequest(signer, signatureRequest);\n return {\n context: encodePermissionsContext({\n contextVersion: \"LOCAL_MODE_DEFERRED_ACTION\",\n deferredAction: buildDeferredActionDigest({\n fullPreSignatureDeferredActionDigest,\n sig: prefixSignatureKeyType(signature.data, signature.type),\n }),\n }),\n };\n },\n };\n};\n"]}
@@ -1,9 +0,0 @@
1
- import { type Address } from "viem";
2
- import type { CreateInnerClientParams, InnerWalletApiClient } from "../types.ts";
3
- /**
4
- * This is a low-level client just used to make RPC requests in remote mode
5
- * This should be wrapped by a higher-level smart account client that provides actions
6
- * that uses this client under the hood
7
- * @returns
8
- */
9
- export declare function createRemoteClient<TAccount extends Address | undefined = Address | undefined>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient;
@@ -1,41 +0,0 @@
1
- import { Provider } from "ox";
2
- import { createClient, custom } from "viem";
3
- import { encodePermissionsContext } from "@alchemy/wallet-api-types/capabilities";
4
- import { WalletServerRpcSchema } from "@alchemy/wallet-api-types/rpc";
5
- import { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
6
- import { internalStateDecorator } from "../internal/decorator.js";
7
- export function createRemoteClient(params) {
8
- const { transport, chain, account } = params;
9
- const client = createClient({
10
- transport: (opts) => custom(Provider.from(transport(opts), { schema: WalletServerRpcSchema }))(opts),
11
- chain,
12
- account,
13
- })
14
- .extend((_client) => ({
15
- policyId: params.policyId,
16
- ...innerClientActions(_client),
17
- }))
18
- .extend(() => ({
19
- internal: internalStateDecorator(),
20
- }));
21
- return client;
22
- }
23
- const innerClientActions = (apiClient) => {
24
- return {
25
- grantPermissions: async (signer, params) => {
26
- const { sessionId, signatureRequest } = await apiClient.request({
27
- method: "wallet_createSession",
28
- params: [params],
29
- });
30
- const signature = await signSignatureRequest(signer, signatureRequest);
31
- return {
32
- context: encodePermissionsContext({
33
- contextVersion: "REMOTE_MODE_DEFERRED_ACTION",
34
- sessionId,
35
- signature: signature.data,
36
- }),
37
- };
38
- },
39
- };
40
- };
41
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
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,EAAgB,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAkBlE,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,SAAS,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;YACvE,OAAO;gBACL,OAAO,EAAE,wBAAwB,CAAC;oBAChC,cAAc,EAAE,6BAA6B;oBAC7C,SAAS;oBACT,SAAS,EAAE,SAAS,CAAC,IAAI;iBAC1B,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Provider } from \"ox\";\nimport { createClient, custom, type Address } from \"viem\";\nimport { encodePermissionsContext } from \"@alchemy/wallet-api-types/capabilities\";\nimport { WalletServerRpcSchema } from \"@alchemy/wallet-api-types/rpc\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n InnerWalletApiClientBase,\n} from \"../types.ts\";\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 TAccount extends Address | undefined = Address | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient;\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(signer, signatureRequest);\n return {\n context: encodePermissionsContext({\n contextVersion: \"REMOTE_MODE_DEFERRED_ACTION\",\n sessionId,\n signature: signature.data,\n }),\n };\n },\n };\n};\n"]}
@@ -1,5 +0,0 @@
1
- export type * from "../isomorphic/client.js";
2
- export { createIsomorphicClient } from "../isomorphic/client.js";
3
- export { createDummySigner } from "../isomorphic/utils/createDummySigner.js";
4
- export type * from "../types.ts";
5
- //# sourceMappingURL=internal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/exports/internal.ts"],"names":[],"mappings":"AAGA,mBAAmB,yBAAyB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAE7E,mBAAmB,aAAa,CAAC"}
@@ -1,14 +0,0 @@
1
- import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
2
- import type { Static } from "@sinclair/typebox";
3
- import { type Chain, type Hex, type Transport } from "viem";
4
- import type { wallet_createSession, WalletServerViemRpcSchema } from "@alchemy/wallet-api-types/rpc";
5
- export type CreateSessionParams = Omit<Static<(typeof wallet_createSession)["properties"]["Request"]["properties"]["params"]>[0], "chainId"> & {
6
- entityId?: Hex;
7
- };
8
- export type CreateSessionResult = Omit<Static<(typeof wallet_createSession)["properties"]["ReturnType"]>, "sessionId"> & {
9
- sessionId: Hex | null;
10
- entityId: Hex;
11
- fullPreSignatureDeferredActionDigest: Hex;
12
- };
13
- export declare function createSession(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: CreateSessionParams): Promise<CreateSessionResult>;
14
- //# sourceMappingURL=createSession.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createSession.d.ts","sourceRoot":"","sources":["../../../../src/isomorphic/actions/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAML,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AAMd,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,+BAA+B,CAAC;AAMvC,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,MAAM,CACJ,CAAC,OAAO,oBAAoB,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC/E,CAAC,CAAC,CAAC,EACJ,SAAS,CACV,GAAG;IACF,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,MAAM,CAAC,CAAC,OAAO,oBAAoB,CAAC,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAAC,EACjE,WAAW,CACZ,GAAG;IACF,SAAS,EAAE,GAAG,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,GAAG,CAAC;IACd,oCAAoC,EAAE,GAAG,CAAC;CAC3C,CAAC;AAEF,wBAAsB,aAAa,CACjC,MAAM,EAAE,kBAAkB,CACxB,SAAS,EACT,KAAK,EACL,oBAAoB,GAAG,SAAS,EAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,yBAAyB,CAC1B,EACD,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAoG9B"}
@@ -1,9 +0,0 @@
1
- import type { Static } from "@sinclair/typebox";
2
- import type { wallet_formatSign } from "@alchemy/wallet-api-types/rpc";
3
- import type { SmartAccountClient, SmartContractAccount } from "@aa-sdk/core";
4
- import { type Chain, type Transport } from "viem";
5
- import type { WalletServerViemRpcSchema } from "@alchemy/wallet-api-types/rpc";
6
- export type FormatSignParams = Static<(typeof wallet_formatSign)["properties"]["Request"]["properties"]["params"]>[0];
7
- export type FormatSignResult = Static<(typeof wallet_formatSign)["properties"]["ReturnType"]>;
8
- export declare function formatSign(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: FormatSignParams): Promise<FormatSignResult>;
9
- //# sourceMappingURL=formatSign.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatSign.d.ts","sourceRoot":"","sources":["../../../../src/isomorphic/actions/formatSign.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAML,KAAK,KAAK,EACV,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAK/E,MAAM,MAAM,gBAAgB,GAAG,MAAM,CACnC,CAAC,OAAO,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC5E,CAAC,CAAC,CAAC,CAAC;AAEL,MAAM,MAAM,gBAAgB,GAAG,MAAM,CACnC,CAAC,OAAO,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CACvD,CAAC;AAEF,wBAAsB,UAAU,CAC9B,MAAM,EAAE,kBAAkB,CACxB,SAAS,EACT,KAAK,EACL,oBAAoB,GAAG,SAAS,EAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,yBAAyB,CAC1B,EACD,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,gBAAgB,CAAC,CAyC3B"}
@@ -1,8 +0,0 @@
1
- import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
2
- import type { Static } from "@sinclair/typebox";
3
- import { type Chain, type Transport } from "viem";
4
- import { type wallet_getCallsStatus, type WalletServerViemRpcSchema } from "@alchemy/wallet-api-types/rpc";
5
- export type GetCallsStatusParams = Static<(typeof wallet_getCallsStatus)["properties"]["Request"]["properties"]["params"]>[0];
6
- export type GetCallsStatusResponse = Static<(typeof wallet_getCallsStatus)["properties"]["ReturnType"]>;
7
- export declare function getCallsStatus(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, callId: GetCallsStatusParams): Promise<GetCallsStatusResponse>;
8
- //# sourceMappingURL=getCallsStatus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getCallsStatus.d.ts","sourceRoot":"","sources":["../../../../src/isomorphic/actions/getCallsStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAGL,KAAK,KAAK,EAGV,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AAEd,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC/B,MAAM,+BAA+B,CAAC;AAIvC,MAAM,MAAM,oBAAoB,GAAG,MAAM,CACvC,CAAC,OAAO,qBAAqB,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CAChF,CAAC,CAAC,CAAC,CAAC;AAEL,MAAM,MAAM,sBAAsB,GAAG,MAAM,CACzC,CAAC,OAAO,qBAAqB,CAAC,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3D,CAAC;AAEF,wBAAsB,cAAc,CAClC,MAAM,EAAE,kBAAkB,CACxB,SAAS,EACT,KAAK,EACL,oBAAoB,GAAG,SAAS,EAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,yBAAyB,CAC1B,EACD,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,sBAAsB,CAAC,CA2CjC"}
@@ -1,8 +0,0 @@
1
- import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
2
- import type { Static } from "@sinclair/typebox";
3
- import { type Chain, type Transport } from "viem";
4
- import type { wallet_prepareCalls, WalletServerViemRpcSchema } from "@alchemy/wallet-api-types/rpc";
5
- export type PrepareCallsParams = Omit<Static<(typeof wallet_prepareCalls)["properties"]["Request"]["properties"]["params"]>[0], "chainId">;
6
- export type PrepareCallsResult = Static<(typeof wallet_prepareCalls)["properties"]["ReturnType"]>;
7
- export declare function prepareCalls(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: PrepareCallsParams): Promise<PrepareCallsResult>;
8
- //# sourceMappingURL=prepareCalls.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prepareCalls.d.ts","sourceRoot":"","sources":["../../../../src/isomorphic/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAML,KAAK,KAAK,EACV,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,+BAA+B,CAAC;AAQvC,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,MAAM,CACJ,CAAC,OAAO,mBAAmB,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC9E,CAAC,CAAC,CAAC,EACJ,SAAS,CACV,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,MAAM,CACrC,CAAC,OAAO,mBAAmB,CAAC,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CACzD,CAAC;AAEF,wBAAsB,YAAY,CAChC,MAAM,EAAE,kBAAkB,CACxB,SAAS,EACT,KAAK,EACL,oBAAoB,GAAG,SAAS,EAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,yBAAyB,CAC1B,EACD,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,CAAC,CA4H7B"}
@@ -1,8 +0,0 @@
1
- import type { Static } from "@sinclair/typebox";
2
- import type { SmartAccountClient, SmartContractAccount } from "@aa-sdk/core";
3
- import { type Chain, type Transport } from "viem";
4
- import type { wallet_prepareSign, WalletServerViemRpcSchema } from "@alchemy/wallet-api-types/rpc";
5
- export type PrepareSignParams = Static<(typeof wallet_prepareSign)["properties"]["Request"]["properties"]["params"]>[0];
6
- export type PrepareSignResult = Static<(typeof wallet_prepareSign)["properties"]["ReturnType"]>;
7
- export declare function prepareSign(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: PrepareSignParams): Promise<PrepareSignResult>;
8
- //# sourceMappingURL=prepareSign.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prepareSign.d.ts","sourceRoot":"","sources":["../../../../src/isomorphic/actions/prepareSign.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAEV,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAIL,KAAK,KAAK,EACV,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,+BAA+B,CAAC;AASvC,MAAM,MAAM,iBAAiB,GAAG,MAAM,CACpC,CAAC,OAAO,kBAAkB,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC7E,CAAC,CAAC,CAAC,CAAC;AAEL,MAAM,MAAM,iBAAiB,GAAG,MAAM,CACpC,CAAC,OAAO,kBAAkB,CAAC,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CACxD,CAAC;AAEF,wBAAsB,WAAW,CAC/B,MAAM,EAAE,kBAAkB,CACxB,SAAS,EACT,KAAK,EACL,oBAAoB,GAAG,SAAS,EAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,yBAAyB,CAC1B,EACD,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAgD5B"}
@@ -1,8 +0,0 @@
1
- import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
2
- import { type Chain, type Transport } from "viem";
3
- import type { wallet_sendPreparedCalls, WalletServerViemRpcSchema } from "@alchemy/wallet-api-types/rpc";
4
- import type { Static } from "@sinclair/typebox";
5
- export type SendPreparedCallsParams = Static<(typeof wallet_sendPreparedCalls)["properties"]["Request"]["properties"]["params"]>[0];
6
- export type SendPreparedCallsResult = Static<(typeof wallet_sendPreparedCalls)["properties"]["ReturnType"]>;
7
- export declare function sendPreparedCalls(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: SendPreparedCallsParams): Promise<SendPreparedCallsResult>;
8
- //# sourceMappingURL=sendPreparedCalls.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sendPreparedCalls.d.ts","sourceRoot":"","sources":["../../../../src/isomorphic/actions/sendPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EASL,KAAK,KAAK,EAEV,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,+BAA+B,CAAC;AAMvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAC1C,CAAC,OAAO,wBAAwB,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CACnF,CAAC,CAAC,CAAC,CAAC;AAEL,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAC1C,CAAC,OAAO,wBAAwB,CAAC,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAC9D,CAAC;AAGF,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,kBAAkB,CACxB,SAAS,EACT,KAAK,EACL,oBAAoB,GAAG,SAAS,EAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,yBAAyB,CAC1B,EACD,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC,CAwLlC"}