@account-kit/wallet-client 0.1.0-alpha.0 → 0.1.0-alpha.2

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 (179) hide show
  1. package/dist/esm/abi/index.d.ts +8 -8
  2. package/dist/esm/abi/index.js +8 -8
  3. package/dist/esm/abi/index.js.map +1 -1
  4. package/dist/esm/capabilities/index.js +3 -3
  5. package/dist/esm/capabilities/index.js.map +1 -1
  6. package/dist/esm/capabilities/overrides.js +1 -1
  7. package/dist/esm/capabilities/overrides.js.map +1 -1
  8. package/dist/esm/capabilities/permissions/index.js +1 -1
  9. package/dist/esm/capabilities/permissions/index.js.map +1 -1
  10. package/dist/esm/capabilities/permissions/mav2.d.ts +2 -2
  11. package/dist/esm/capabilities/permissions/mav2.js +1 -1
  12. package/dist/esm/capabilities/permissions/mav2.js.map +1 -1
  13. package/dist/esm/client/actions/createAccount.d.ts +27 -2
  14. package/dist/esm/client/actions/createAccount.js +25 -0
  15. package/dist/esm/client/actions/createAccount.js.map +1 -1
  16. package/dist/esm/client/actions/getCallsStatus.d.ts +21 -2
  17. package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
  18. package/dist/esm/client/actions/grantPermissions.d.ts +60 -2
  19. package/dist/esm/client/actions/grantPermissions.js.map +1 -1
  20. package/dist/esm/client/actions/listAccounts.d.ts +26 -2
  21. package/dist/esm/client/actions/listAccounts.js +24 -0
  22. package/dist/esm/client/actions/listAccounts.js.map +1 -1
  23. package/dist/esm/client/actions/prepareCalls.d.ts +28 -2
  24. package/dist/esm/client/actions/prepareCalls.js.map +1 -1
  25. package/dist/esm/client/actions/requestAccount.d.ts +23 -4
  26. package/dist/esm/client/actions/requestAccount.js +16 -5
  27. package/dist/esm/client/actions/requestAccount.js.map +1 -1
  28. package/dist/esm/client/actions/sendPreparedCalls.d.ts +39 -2
  29. package/dist/esm/client/actions/sendPreparedCalls.js +37 -0
  30. package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
  31. package/dist/esm/client/actions/signMessage.d.ts +23 -3
  32. package/dist/esm/client/actions/signMessage.js +5 -3
  33. package/dist/esm/client/actions/signMessage.js.map +1 -1
  34. package/dist/esm/client/actions/signSignatureRequest.d.ts +32 -1
  35. package/dist/esm/client/actions/signSignatureRequest.js +2 -2
  36. package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
  37. package/dist/esm/client/actions/signTypedData.d.ts +36 -3
  38. package/dist/esm/client/actions/signTypedData.js +4 -2
  39. package/dist/esm/client/actions/signTypedData.js.map +1 -1
  40. package/dist/esm/client/client.e2e-test.js +101 -13
  41. package/dist/esm/client/client.e2e-test.js.map +1 -1
  42. package/dist/esm/client/decorator.d.ts +14 -12
  43. package/dist/esm/client/decorator.js +10 -10
  44. package/dist/esm/client/decorator.js.map +1 -1
  45. package/dist/esm/client/index.d.ts +5 -5
  46. package/dist/esm/client/index.js +32 -6
  47. package/dist/esm/client/index.js.map +1 -1
  48. package/dist/esm/exports/index.d.ts +14 -13
  49. package/dist/esm/exports/index.js +14 -13
  50. package/dist/esm/exports/index.js.map +1 -1
  51. package/dist/esm/exports/internal.d.ts +13 -13
  52. package/dist/esm/exports/internal.js +11 -11
  53. package/dist/esm/exports/internal.js.map +1 -1
  54. package/dist/esm/internal/decorator.d.ts +2 -0
  55. package/dist/esm/internal/decorator.js +10 -0
  56. package/dist/esm/internal/decorator.js.map +1 -0
  57. package/dist/esm/isomorphic/actions/createSession.d.ts +3 -3
  58. package/dist/esm/isomorphic/actions/createSession.js +5 -5
  59. package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
  60. package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +2 -2
  61. package/dist/esm/isomorphic/actions/getCallsStatus.js +3 -3
  62. package/dist/esm/isomorphic/actions/getCallsStatus.js.map +1 -1
  63. package/dist/esm/isomorphic/actions/prepareCalls.d.ts +2 -2
  64. package/dist/esm/isomorphic/actions/prepareCalls.js +2 -2
  65. package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
  66. package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +2 -2
  67. package/dist/esm/isomorphic/actions/sendPreparedCalls.js +2 -2
  68. package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
  69. package/dist/esm/isomorphic/client.d.ts +6 -6
  70. package/dist/esm/isomorphic/client.js +4 -4
  71. package/dist/esm/isomorphic/client.js.map +1 -1
  72. package/dist/esm/isomorphic/utils/createAccount.d.ts +2 -2
  73. package/dist/esm/isomorphic/utils/createAccount.js +1 -1
  74. package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
  75. package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +4 -4
  76. package/dist/esm/isomorphic/utils/parsePermissionsContext.js +1 -1
  77. package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +1 -1
  78. package/dist/esm/local/client.d.ts +1 -1
  79. package/dist/esm/local/client.js +12 -5
  80. package/dist/esm/local/client.js.map +1 -1
  81. package/dist/esm/remote/client.d.ts +1 -1
  82. package/dist/esm/remote/client.js +9 -4
  83. package/dist/esm/remote/client.js.map +1 -1
  84. package/dist/esm/rpc/request.js +3 -3
  85. package/dist/esm/rpc/request.js.map +1 -1
  86. package/dist/esm/rpc/schema.d.ts +1 -1
  87. package/dist/esm/rpc/schema.js +1 -1
  88. package/dist/esm/rpc/schema.js.map +1 -1
  89. package/dist/esm/types.d.ts +15 -4
  90. package/dist/esm/types.js.map +1 -1
  91. package/dist/types/abi/index.d.ts +8 -8
  92. package/dist/types/abi/index.d.ts.map +1 -1
  93. package/dist/types/capabilities/permissions/mav2.d.ts +2 -2
  94. package/dist/types/capabilities/permissions/mav2.d.ts.map +1 -1
  95. package/dist/types/client/actions/createAccount.d.ts +27 -2
  96. package/dist/types/client/actions/createAccount.d.ts.map +1 -1
  97. package/dist/types/client/actions/getCallsStatus.d.ts +21 -2
  98. package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
  99. package/dist/types/client/actions/grantPermissions.d.ts +60 -2
  100. package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
  101. package/dist/types/client/actions/listAccounts.d.ts +26 -2
  102. package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
  103. package/dist/types/client/actions/prepareCalls.d.ts +28 -2
  104. package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
  105. package/dist/types/client/actions/requestAccount.d.ts +23 -4
  106. package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
  107. package/dist/types/client/actions/sendPreparedCalls.d.ts +39 -2
  108. package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -1
  109. package/dist/types/client/actions/signMessage.d.ts +23 -3
  110. package/dist/types/client/actions/signMessage.d.ts.map +1 -1
  111. package/dist/types/client/actions/signSignatureRequest.d.ts +32 -1
  112. package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
  113. package/dist/types/client/actions/signTypedData.d.ts +36 -3
  114. package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
  115. package/dist/types/client/decorator.d.ts +14 -12
  116. package/dist/types/client/decorator.d.ts.map +1 -1
  117. package/dist/types/client/index.d.ts +5 -5
  118. package/dist/types/client/index.d.ts.map +1 -1
  119. package/dist/types/exports/index.d.ts +14 -13
  120. package/dist/types/exports/index.d.ts.map +1 -1
  121. package/dist/types/exports/internal.d.ts +13 -13
  122. package/dist/types/exports/internal.d.ts.map +1 -1
  123. package/dist/types/internal/decorator.d.ts +3 -0
  124. package/dist/types/internal/decorator.d.ts.map +1 -0
  125. package/dist/types/isomorphic/actions/createSession.d.ts +3 -3
  126. package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
  127. package/dist/types/isomorphic/actions/getCallsStatus.d.ts +2 -2
  128. package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +1 -1
  129. package/dist/types/isomorphic/actions/prepareCalls.d.ts +2 -2
  130. package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
  131. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +2 -2
  132. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
  133. package/dist/types/isomorphic/client.d.ts +6 -6
  134. package/dist/types/isomorphic/client.d.ts.map +1 -1
  135. package/dist/types/isomorphic/utils/createAccount.d.ts +2 -2
  136. package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -1
  137. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +4 -4
  138. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +1 -1
  139. package/dist/types/local/client.d.ts +1 -1
  140. package/dist/types/local/client.d.ts.map +1 -1
  141. package/dist/types/remote/client.d.ts +1 -1
  142. package/dist/types/remote/client.d.ts.map +1 -1
  143. package/dist/types/rpc/schema.d.ts +1 -1
  144. package/dist/types/types.d.ts +15 -4
  145. package/dist/types/types.d.ts.map +1 -1
  146. package/package.json +14 -7
  147. package/src/abi/index.ts +8 -8
  148. package/src/capabilities/index.ts +3 -3
  149. package/src/capabilities/overrides.ts +1 -1
  150. package/src/capabilities/permissions/index.ts +1 -1
  151. package/src/capabilities/permissions/mav2.ts +3 -3
  152. package/src/client/actions/createAccount.ts +27 -2
  153. package/src/client/actions/getCallsStatus.ts +21 -2
  154. package/src/client/actions/grantPermissions.ts +60 -2
  155. package/src/client/actions/listAccounts.ts +26 -2
  156. package/src/client/actions/prepareCalls.ts +28 -2
  157. package/src/client/actions/requestAccount.ts +44 -9
  158. package/src/client/actions/sendPreparedCalls.ts +39 -2
  159. package/src/client/actions/signMessage.ts +26 -6
  160. package/src/client/actions/signSignatureRequest.ts +33 -2
  161. package/src/client/actions/signTypedData.ts +41 -5
  162. package/src/client/client.e2e-test.ts +122 -13
  163. package/src/client/decorator.ts +25 -27
  164. package/src/client/index.ts +47 -13
  165. package/src/exports/index.ts +14 -13
  166. package/src/exports/internal.ts +13 -13
  167. package/src/internal/decorator.ts +12 -0
  168. package/src/isomorphic/actions/createSession.ts +15 -15
  169. package/src/isomorphic/actions/getCallsStatus.ts +6 -6
  170. package/src/isomorphic/actions/prepareCalls.ts +4 -4
  171. package/src/isomorphic/actions/sendPreparedCalls.ts +4 -4
  172. package/src/isomorphic/client.ts +8 -5
  173. package/src/isomorphic/utils/createAccount.ts +3 -3
  174. package/src/isomorphic/utils/parsePermissionsContext.ts +3 -3
  175. package/src/local/client.ts +56 -46
  176. package/src/remote/client.ts +13 -8
  177. package/src/rpc/request.ts +3 -3
  178. package/src/rpc/schema.ts +1 -1
  179. package/src/types.ts +18 -4
@@ -1,10 +1,10 @@
1
1
  import { type SmartAccountClient, type SmartAccountClientRpcSchema, type SmartContractAccount } from "@aa-sdk/core";
2
2
  import { type Chain, type Transport } from "viem";
3
- import type { WalletServerViemRpcSchema } from "../rpc/schema";
4
- import { type CreateSessionParams } from "./actions/createSession";
5
- import { type GetCallsStatusParams } from "./actions/getCallsStatus";
6
- import { type PrepareCallsParams } from "./actions/prepareCalls";
7
- import { type SendPreparedCallsParams } from "./actions/sendPreparedCalls";
3
+ import type { WalletServerViemRpcSchema } from "../rpc/schema.js";
4
+ import { type CreateSessionParams } from "./actions/createSession.js";
5
+ import { type GetCallsStatusParams } from "./actions/getCallsStatus.js";
6
+ import { type PrepareCallsParams } from "./actions/prepareCalls.js";
7
+ import { type SendPreparedCallsParams } from "./actions/sendPreparedCalls.js";
8
8
  type ClientParams = {
9
9
  chain: Chain;
10
10
  transport: Transport;
@@ -91,7 +91,7 @@ export declare function isomorphicClientActions(client: SmartAccountClient<Trans
91
91
  atomic: boolean;
92
92
  status: 100 | 200 | 400 | 500 | 600;
93
93
  }>;
94
- createSession: (params: CreateSessionParams) => Promise<import("./actions/createSession").CreateSessionResult>;
94
+ createSession: (params: CreateSessionParams) => Promise<import("./actions/createSession.js").CreateSessionResult>;
95
95
  };
96
96
  export declare function createIsomorphicClient({ chain, transport, policyId, useErc7677middleware, }: ClientParams): SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, ReturnType<typeof isomorphicClientActions>, WalletServerViemRpcSchema & SmartAccountClientRpcSchema>;
97
97
  export type IsomorphicClient = ReturnType<typeof createIsomorphicClient>;
@@ -1,10 +1,10 @@
1
1
  import { createSmartAccountClient, } from "@aa-sdk/core";
2
2
  import { alchemyFeeEstimator, alchemyGasAndPaymasterAndDataMiddleware, alchemyGasManagerMiddleware, } from "@account-kit/infra";
3
3
  import {} from "viem";
4
- import { createSession, } from "./actions/createSession";
5
- import { getCallsStatus, } from "./actions/getCallsStatus";
6
- import { prepareCalls } from "./actions/prepareCalls";
7
- import { sendPreparedCalls, } from "./actions/sendPreparedCalls";
4
+ import { createSession, } from "./actions/createSession.js";
5
+ import { getCallsStatus, } from "./actions/getCallsStatus.js";
6
+ import { prepareCalls, } from "./actions/prepareCalls.js";
7
+ import { sendPreparedCalls, } from "./actions/sendPreparedCalls.js";
8
8
  export function isomorphicClientActions(client) {
9
9
  return {
10
10
  prepareCalls: (params) => prepareCalls(client, params),
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/isomorphic/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAIzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,uCAAuC,EACvC,2BAA2B,GAE5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA8B,MAAM,MAAM,CAAC;AAElD,OAAO,EACL,aAAa,GAEd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,GAEf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAA2B,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EACL,iBAAiB,GAElB,MAAM,6BAA6B,CAAC;AAUrC,MAAM,UAAU,uBAAuB,CACrC,MAMC;IAED,OAAO;QACL,YAAY,EAAE,CAAC,MAA0B,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;QAC1E,iBAAiB,EAAE,CAAC,MAA+B,EAAE,EAAE,CACrD,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;QACnC,cAAc,EAAE,CAAC,MAA4B,EAAE,EAAE,CAC/C,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC;QAChC,aAAa,EAAE,CAAC,MAA2B,EAAE,EAAE,CAC7C,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC;KAChC,CAAC;AACJ,CAAC;AAED,wJAAwJ;AACxJ,wDAAwD;AACxD,MAAM,UAAU,sBAAsB,CAAC,EACrC,KAAK,EACL,SAAS,EACT,QAAQ,EACR,oBAAoB,GAAG,IAAI,GACd;IAOb,4FAA4F;IAC5F,MAAM,MAAM,GAAG,wBAAwB,CAAC;QACtC,SAAS;QACT,KAAK;QACL,gEAAgE;QAChE,YAAY,EAAE,mBAAmB,CAAC,SAA6B,CAAC;QAChE,GAAG,CAAC,QAAQ;YACV,CAAC,CAAC,oBAAoB;gBACpB,CAAC,CAAC,2BAA2B,CAAC,QAAQ,CAAC;gBACvC,CAAC,CAAC,oGAAoG;oBACpG,uCAAuC,CAAC;wBACtC,QAAQ;wBACR,SAAS,EAAE,SAA6B;qBACzC,CAAC;YACN,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAEnC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountClientRpcSchema,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport {\n alchemyFeeEstimator,\n alchemyGasAndPaymasterAndDataMiddleware,\n alchemyGasManagerMiddleware,\n type AlchemyTransport,\n} from \"@account-kit/infra\";\nimport { type Chain, type Transport } from \"viem\";\nimport type { WalletServerViemRpcSchema } from \"../rpc/schema\";\nimport {\n createSession,\n type CreateSessionParams,\n} from \"./actions/createSession\";\nimport {\n getCallsStatus,\n type GetCallsStatusParams,\n} from \"./actions/getCallsStatus\";\nimport { prepareCalls, type PrepareCallsParams } from \"./actions/prepareCalls\";\nimport {\n sendPreparedCalls,\n type SendPreparedCallsParams,\n} from \"./actions/sendPreparedCalls\";\n\n// let's start with something that takes in as many params as possible, then we can eliminate them as we don't need them\ntype ClientParams = {\n chain: Chain;\n transport: Transport;\n policyId?: string;\n useErc7677middleware?: boolean;\n};\n\nexport function isomorphicClientActions(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n) {\n return {\n prepareCalls: (params: PrepareCallsParams) => prepareCalls(client, params),\n sendPreparedCalls: (params: SendPreparedCallsParams) =>\n sendPreparedCalls(client, params),\n getCallsStatus: (params: GetCallsStatusParams) =>\n getCallsStatus(client, params),\n createSession: (params: CreateSessionParams) =>\n createSession(client, params),\n };\n}\n\n// the isomorphic client likely won't be exposed directly. This client contains the business logic that can be run on the wallet server or on the client\n// if the dev chooses to run the client in \"local\" mode.\nexport function createIsomorphicClient({\n chain,\n transport,\n policyId,\n useErc7677middleware = true,\n}: ClientParams): SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n ReturnType<typeof isomorphicClientActions>,\n WalletServerViemRpcSchema & SmartAccountClientRpcSchema\n> {\n // This must be a smart account client since as of now we use it to build UOs under the hood\n const client = createSmartAccountClient({\n transport,\n chain,\n // TODO: we will want to enforce alchemy transport here probably\n feeEstimator: alchemyFeeEstimator(transport as AlchemyTransport),\n ...(policyId\n ? useErc7677middleware\n ? alchemyGasManagerMiddleware(policyId)\n : // NOTE: DO NOT USE THIS MIDDLEWARE in the server, currently we require using the erc7677 middleware\n alchemyGasAndPaymasterAndDataMiddleware({\n policyId,\n transport: transport as AlchemyTransport,\n })\n : {}),\n }).extend(isomorphicClientActions);\n\n return client;\n}\n\nexport type IsomorphicClient = ReturnType<typeof createIsomorphicClient>;\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/isomorphic/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAIzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,m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C,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAEnC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountClientRpcSchema,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport {\n alchemyFeeEstimator,\n alchemyGasAndPaymasterAndDataMiddleware,\n alchemyGasManagerMiddleware,\n type AlchemyTransport,\n} from \"@account-kit/infra\";\nimport { type Chain, type Transport } from \"viem\";\nimport type { WalletServerViemRpcSchema } from \"../rpc/schema.js\";\nimport {\n createSession,\n type CreateSessionParams,\n} from \"./actions/createSession.js\";\nimport {\n getCallsStatus,\n type GetCallsStatusParams,\n} from \"./actions/getCallsStatus.js\";\nimport {\n prepareCalls,\n type PrepareCallsParams,\n} from \"./actions/prepareCalls.js\";\nimport {\n sendPreparedCalls,\n type SendPreparedCallsParams,\n} from \"./actions/sendPreparedCalls.js\";\n\n// let's start with something that takes in as many params as possible, then we can eliminate them as we don't need them\ntype ClientParams = {\n chain: Chain;\n transport: Transport;\n policyId?: string;\n useErc7677middleware?: boolean;\n};\n\nexport function isomorphicClientActions(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n) {\n return {\n prepareCalls: (params: PrepareCallsParams) => prepareCalls(client, params),\n sendPreparedCalls: (params: SendPreparedCallsParams) =>\n sendPreparedCalls(client, params),\n getCallsStatus: (params: GetCallsStatusParams) =>\n getCallsStatus(client, params),\n createSession: (params: CreateSessionParams) =>\n createSession(client, params),\n };\n}\n\n// the isomorphic client likely won't be exposed directly. This client contains the business logic that can be run on the wallet server or on the client\n// if the dev chooses to run the client in \"local\" mode.\nexport function createIsomorphicClient({\n chain,\n transport,\n policyId,\n useErc7677middleware = true,\n}: ClientParams): SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n ReturnType<typeof isomorphicClientActions>,\n WalletServerViemRpcSchema & SmartAccountClientRpcSchema\n> {\n // This must be a smart account client since as of now we use it to build UOs under the hood\n const client = createSmartAccountClient({\n transport,\n chain,\n // TODO: we will want to enforce alchemy transport here probably\n feeEstimator: alchemyFeeEstimator(transport as AlchemyTransport),\n ...(policyId\n ? useErc7677middleware\n ? alchemyGasManagerMiddleware(policyId)\n : // NOTE: DO NOT USE THIS MIDDLEWARE in the server, currently we require using the erc7677 middleware\n alchemyGasAndPaymasterAndDataMiddleware({\n policyId,\n transport: transport as AlchemyTransport,\n })\n : {}),\n }).extend(isomorphicClientActions);\n\n return client;\n}\n\nexport type IsomorphicClient = ReturnType<typeof createIsomorphicClient>;\n"]}
@@ -2,8 +2,8 @@ import type { SmartAccountSigner, SmartContractAccount } from "@aa-sdk/core";
2
2
  import { type ModularAccountV2 } from "@account-kit/smart-contracts";
3
3
  import type { StaticDecode } from "@sinclair/typebox";
4
4
  import type { Address, Chain, Transport } from "viem";
5
- import type { TypeSerializedInitcode } from "../../schemas";
6
- import type { Capabilities } from "../../capabilities";
5
+ import type { Capabilities } from "../../capabilities/index.js";
6
+ import type { TypeSerializedInitcode } from "../../schemas.js";
7
7
  type CreateAccountParams = {
8
8
  chain: Chain;
9
9
  transport: Transport;
@@ -1,6 +1,6 @@
1
1
  import { createModularAccountV2, } from "@account-kit/smart-contracts";
2
2
  import { concatHex, hexToNumber } from "viem";
3
- import { parsePermissionsContext } from "./parsePermissionsContext";
3
+ import { parsePermissionsContext } from "./parsePermissionsContext.js";
4
4
  /**
5
5
  * Creates a smart account instance from the given parameters.
6
6
  * @param params - The parameters for creating a smart account.
@@ -1 +1 @@
1
- {"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createAccount.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,GAEvB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAG9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAWpE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA2B;IAE3B,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,CAAC;IAC5D,mDAAmD;IACnD,IAAI,EAAE,CAAC,WAAW,KAAK,gBAAgB,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,aAAa,GAAG,uBAAuB,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAEvE,MAAM,YAAY,GAChB,aAAa,EAAE,cAAc,KAAK,qBAAqB;QACrD,CAAC,CAAC;YACE,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC;YAC7C,kBAAkB,EAAE,aAAa,CAAC,kBAAkB;SACrD;QACH,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO,sBAAsB,CAAC;QAC5B,GAAG,aAAa;QAChB,YAAY;QACZ,cAAc,EAAE,aAAa,EAAE,cAAc;QAC7C,QAAQ,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC;KACzD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,OAA6B;IAE7B,OAAO,OAAO,CAAC,MAAM,KAAK,kBAAkB,CAAC;AAC/C,CAAC","sourcesContent":["import type { SmartAccountSigner, SmartContractAccount } from \"@aa-sdk/core\";\nimport {\n createModularAccountV2,\n type ModularAccountV2,\n} from \"@account-kit/smart-contracts\";\nimport type { StaticDecode } from \"@sinclair/typebox\";\nimport type { Address, Chain, Transport } from \"viem\";\nimport { concatHex, hexToNumber } from \"viem\";\nimport type { TypeSerializedInitcode } from \"../../schemas\";\nimport type { Capabilities } from \"../../capabilities\";\nimport { parsePermissionsContext } from \"./parsePermissionsContext\";\n\ntype CreateAccountParams = {\n chain: Chain;\n transport: Transport;\n signer: SmartAccountSigner;\n accountAddress: Address;\n counterfactualInfo: StaticDecode<typeof TypeSerializedInitcode>;\n capabilities?: StaticDecode<typeof Capabilities>;\n};\n\n/**\n * Creates a smart account instance from the given parameters.\n * @param params - The parameters for creating a smart account.\n * @returns A promise that resolves to the created smart account.\n */\nexport async function createAccount(\n params: CreateAccountParams,\n): Promise<SmartContractAccount> {\n const { counterfactualInfo: ci, ...accountParams } = params;\n // TODO: Implement support for other account types.\n if (ci.factoryType !== \"MAv2.0.0-sma-b\") {\n throw new Error(\"Only MAv2 SMA-B accounts are currently supported\");\n }\n\n const parsedContext = parsePermissionsContext(params.capabilities, ci);\n\n const signerEntity =\n parsedContext?.contextVersion === \"NON_DEFERRED_ACTION\"\n ? {\n entityId: hexToNumber(parsedContext.entityId),\n isGlobalValidation: parsedContext.isGlobalValidation,\n }\n : undefined;\n\n return createModularAccountV2({\n ...accountParams,\n signerEntity,\n deferredAction: parsedContext?.deferredAction,\n initCode: concatHex([ci.factoryAddress, ci.factoryData]),\n });\n}\n\nexport function isModularAccountV2(\n account: SmartContractAccount,\n): account is ModularAccountV2 {\n return account.source === \"ModularAccountV2\";\n}\n"]}
1
+ {"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createAccount.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,GAEvB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAG9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAWvE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA2B;IAE3B,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,CAAC;IAC5D,mDAAmD;IACnD,IAAI,EAAE,CAAC,WAAW,KAAK,gBAAgB,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,aAAa,GAAG,uBAAuB,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAEvE,MAAM,YAAY,GAChB,aAAa,EAAE,cAAc,KAAK,qBAAqB;QACrD,CAAC,CAAC;YACE,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC;YAC7C,kBAAkB,EAAE,aAAa,CAAC,kBAAkB;SACrD;QACH,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO,sBAAsB,CAAC;QAC5B,GAAG,aAAa;QAChB,YAAY;QACZ,cAAc,EAAE,aAAa,EAAE,cAAc;QAC7C,QAAQ,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC;KACzD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,OAA6B;IAE7B,OAAO,OAAO,CAAC,MAAM,KAAK,kBAAkB,CAAC;AAC/C,CAAC","sourcesContent":["import type { SmartAccountSigner, SmartContractAccount } from \"@aa-sdk/core\";\nimport {\n createModularAccountV2,\n type ModularAccountV2,\n} from \"@account-kit/smart-contracts\";\nimport type { StaticDecode } from \"@sinclair/typebox\";\nimport type { Address, Chain, Transport } from \"viem\";\nimport { concatHex, hexToNumber } from \"viem\";\nimport type { Capabilities } from \"../../capabilities/index.js\";\nimport type { TypeSerializedInitcode } from \"../../schemas.js\";\nimport { parsePermissionsContext } from \"./parsePermissionsContext.js\";\n\ntype CreateAccountParams = {\n chain: Chain;\n transport: Transport;\n signer: SmartAccountSigner;\n accountAddress: Address;\n counterfactualInfo: StaticDecode<typeof TypeSerializedInitcode>;\n capabilities?: StaticDecode<typeof Capabilities>;\n};\n\n/**\n * Creates a smart account instance from the given parameters.\n * @param params - The parameters for creating a smart account.\n * @returns A promise that resolves to the created smart account.\n */\nexport async function createAccount(\n params: CreateAccountParams,\n): Promise<SmartContractAccount> {\n const { counterfactualInfo: ci, ...accountParams } = params;\n // TODO: Implement support for other account types.\n if (ci.factoryType !== \"MAv2.0.0-sma-b\") {\n throw new Error(\"Only MAv2 SMA-B accounts are currently supported\");\n }\n\n const parsedContext = parsePermissionsContext(params.capabilities, ci);\n\n const signerEntity =\n parsedContext?.contextVersion === \"NON_DEFERRED_ACTION\"\n ? {\n entityId: hexToNumber(parsedContext.entityId),\n isGlobalValidation: parsedContext.isGlobalValidation,\n }\n : undefined;\n\n return createModularAccountV2({\n ...accountParams,\n signerEntity,\n deferredAction: parsedContext?.deferredAction,\n initCode: concatHex([ci.factoryAddress, ci.factoryData]),\n });\n}\n\nexport function isModularAccountV2(\n account: SmartContractAccount,\n): account is ModularAccountV2 {\n return account.source === \"ModularAccountV2\";\n}\n"]}
@@ -1,15 +1,15 @@
1
1
  import type { StaticDecode } from "@sinclair/typebox";
2
- import type { PrepareCallsParams } from "../actions/prepareCalls";
3
- import type { TypeSerializedInitcode } from "../../schemas";
2
+ import type { TypeSerializedInitcode } from "../../schemas.js";
3
+ import type { PrepareCallsParams } from "../actions/prepareCalls.js";
4
4
  export declare function parsePermissionsContext(capabilities: PrepareCallsParams["capabilities"], parsedCi: StaticDecode<typeof TypeSerializedInitcode>): ({
5
- contextVersion: keyof typeof import("../../exports/internal").PermissionsContextVersion;
5
+ contextVersion: keyof typeof import("../../exports/internal.js").PermissionsContextVersion;
6
6
  } & {
7
7
  contextVersion: "LOCAL_MODE_DEFERRED_ACTION";
8
8
  deferredAction: import("viem").Hex;
9
9
  sessionId?: never;
10
10
  signature?: never;
11
11
  }) | ({
12
- contextVersion: keyof typeof import("../../exports/internal").PermissionsContextVersion;
12
+ contextVersion: keyof typeof import("../../exports/internal.js").PermissionsContextVersion;
13
13
  } & {
14
14
  contextVersion: "NON_DEFERRED_ACTION";
15
15
  deferredAction?: never;
@@ -1,5 +1,5 @@
1
1
  import { InvalidRequestError } from "ox/RpcResponse";
2
- import { decodePermissionsContext } from "../../capabilities/permissions/mav2";
2
+ import { decodePermissionsContext } from "../../capabilities/permissions/mav2.js";
3
3
  export function parsePermissionsContext(capabilities, parsedCi) {
4
4
  if (!capabilities?.permissions?.context) {
5
5
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"parsePermissionsContext.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/parsePermissionsContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE/E,MAAM,UAAU,uBAAuB,CACrC,YAAgD,EAChD,QAAqD;IAErD,IAAI,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IACE,YAAY,EAAE,WAAW,EAAE,OAAO;QAClC,QAAQ,CAAC,WAAW,KAAK,gBAAgB,EACzC,CAAC;QACD,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,2DAA2D;SACrE,CAAC,CAAC;IACL,CAAC;IAED,MAAM,OAAO,GAAG,wBAAwB,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAE3E,IAAI,OAAO,EAAE,cAAc,KAAK,6BAA6B,EAAE,CAAC;QAC9D,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,gEAAgE;SAC1E,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { StaticDecode } from \"@sinclair/typebox\";\nimport type { PrepareCallsParams } from \"../actions/prepareCalls\";\nimport type { TypeSerializedInitcode } from \"../../schemas\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { decodePermissionsContext } from \"../../capabilities/permissions/mav2\";\n\nexport function parsePermissionsContext(\n capabilities: PrepareCallsParams[\"capabilities\"],\n parsedCi: StaticDecode<typeof TypeSerializedInitcode>,\n) {\n if (!capabilities?.permissions?.context) {\n return undefined;\n }\n\n if (\n capabilities?.permissions?.context &&\n parsedCi.factoryType !== \"MAv2.0.0-sma-b\"\n ) {\n throw new InvalidRequestError({\n message: \"Permissions are currently only supported by MAv2 accounts\",\n });\n }\n\n const context = decodePermissionsContext(capabilities.permissions.context);\n\n if (context?.contextVersion === \"REMOTE_MODE_DEFERRED_ACTION\") {\n throw new InvalidRequestError({\n message: \"Remote mode deferred action not supported in isomorphic client\",\n });\n }\n\n return context;\n}\n"]}
1
+ {"version":3,"file":"parsePermissionsContext.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/parsePermissionsContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAIlF,MAAM,UAAU,uBAAuB,CACrC,YAAgD,EAChD,QAAqD;IAErD,IAAI,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IACE,YAAY,EAAE,WAAW,EAAE,OAAO;QAClC,QAAQ,CAAC,WAAW,KAAK,gBAAgB,EACzC,CAAC;QACD,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,2DAA2D;SACrE,CAAC,CAAC;IACL,CAAC;IAED,MAAM,OAAO,GAAG,wBAAwB,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAE3E,IAAI,OAAO,EAAE,cAAc,KAAK,6BAA6B,EAAE,CAAC;QAC9D,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,gEAAgE;SAC1E,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { StaticDecode } from \"@sinclair/typebox\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { decodePermissionsContext } from \"../../capabilities/permissions/mav2.js\";\nimport type { TypeSerializedInitcode } from \"../../schemas.js\";\nimport type { PrepareCallsParams } from \"../actions/prepareCalls.js\";\n\nexport function parsePermissionsContext(\n capabilities: PrepareCallsParams[\"capabilities\"],\n parsedCi: StaticDecode<typeof TypeSerializedInitcode>,\n) {\n if (!capabilities?.permissions?.context) {\n return undefined;\n }\n\n if (\n capabilities?.permissions?.context &&\n parsedCi.factoryType !== \"MAv2.0.0-sma-b\"\n ) {\n throw new InvalidRequestError({\n message: \"Permissions are currently only supported by MAv2 accounts\",\n });\n }\n\n const context = decodePermissionsContext(capabilities.permissions.context);\n\n if (context?.contextVersion === \"REMOTE_MODE_DEFERRED_ACTION\") {\n throw new InvalidRequestError({\n message: \"Remote mode deferred action not supported in isomorphic client\",\n });\n }\n\n return context;\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  import { type Address, type JsonRpcAccount } from "viem";
2
- import type { CreateInnerClientParams, InnerWalletApiClient } from "../types";
2
+ import type { CreateInnerClientParams, InnerWalletApiClient } from "../types.ts";
3
3
  export declare function createLocalClient<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;
@@ -1,10 +1,11 @@
1
1
  import { split } from "@aa-sdk/core";
2
2
  import { buildDeferredActionDigest } from "@account-kit/smart-contracts/experimental";
3
3
  import { createClient, custom } from "viem";
4
- import { encodePermissionsContext, prefixSignatureKeyType, } from "../capabilities/permissions/mav2";
5
- import { signSignatureRequest } from "../client/actions/signSignatureRequest";
6
- import { createIsomorphicClient, } from "../isomorphic/client";
7
- import { assertNever } from "../utils";
4
+ import { encodePermissionsContext, prefixSignatureKeyType, } from "../capabilities/permissions/mav2.js";
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";
8
9
  const localMethods = [
9
10
  "wallet_prepareCalls",
10
11
  "wallet_sendPreparedCalls",
@@ -56,6 +57,8 @@ export function createLocalClient(params) {
56
57
  return assertNever(args.method, `Unexpected method: ${args.method}`);
57
58
  }
58
59
  },
60
+ }, {
61
+ retryCount: 0,
59
62
  }),
60
63
  },
61
64
  ],
@@ -65,9 +68,13 @@ export function createLocalClient(params) {
65
68
  transport: innerTransport,
66
69
  chain,
67
70
  account,
68
- }).extend(() => ({
71
+ })
72
+ .extend(() => ({
69
73
  policyId,
70
74
  ...innerClientActions(isomorphicClient),
75
+ }))
76
+ .extend(() => ({
77
+ internal: internalStateDecorator(),
71
78
  }));
72
79
  }
73
80
  const innerClientActions = (isomorphicClient) => {
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/local/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,EAAqC,MAAM,MAAM,CAAC;AAC/E,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E,OAAO,EACL,sBAAsB,GAEvB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,YAAY,GAAG;IACnB,qBAAqB;IACrB,0BAA0B;IAC1B,uBAAuB;IACvB,sBAAsB;CACK,CAAC;AAS9B,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,oBAAoB,EAAE,KAAK;KAC5B,CAAC,CAAC;IAEH,MAAM,SAAS,GAA8D;QAC3E,C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4BACD;gCACE,OAAO,WAAW,CAChB,IAAI,CAAC,MAAM,EACX,sBAAsB,IAAI,CAAC,MAAM,EAAE,CACpC,CAAC;wBACN,CAAC;oBACH,CAAC;iBACF,CAAC;aACH;SACF;QACD,QAAQ,EAAE,SAAS;KACpB,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;QAClB,SAAS,EAAE,cAAc;QACzB,KAAK;QACL,OAAO;KACR,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACf,QAAQ;QACR,GAAG,kBAAkB,CAAC,gBAAgB,CAAC;KACxC,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,kBAAkB,GAAG,CACzB,gBAAkC,EACd,EAAE;IACtB,OAAO;QACL,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,EAAE,gBAAgB,EAAE,oCAAoC,EAAE,GAC9D,MAAM,gBAAgB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAE/C,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,oBAAoB,CAC9C,MAAM,EACN,gBAAgB,CACjB,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,wBAAwB,CAAC;oBAChC,cAAc,EAAE,4BAA4B;oBAC5C,cAAc,EAAE,yBAAyB,CAAC;wBACxC,oCAAoC;wBACpC,GAAG,EAAE,sBAAsB,CAAC,SAAS,EAAE,WAAW,CAAC;qBACpD,CAAC;iBACH,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { split } from \"@aa-sdk/core\";\nimport { buildDeferredActionDigest } from \"@account-kit/smart-contracts/experimental\";\nimport { createClient, custom, type Address, type JsonRpcAccount } from \"viem\";\nimport {\n encodePermissionsContext,\n prefixSignatureKeyType,\n} from \"../capabilities/permissions/mav2\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest\";\nimport type { PrepareCallsParams } from \"../isomorphic/actions/prepareCalls\";\nimport {\n createIsomorphicClient,\n type IsomorphicClient,\n} from \"../isomorphic/client\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n} from \"../types\";\nimport { assertNever } from \"../utils\";\n\nconst localMethods = [\n \"wallet_prepareCalls\",\n \"wallet_sendPreparedCalls\",\n \"wallet_getCallsStatus\",\n \"wallet_createSession\",\n] as const satisfies string[];\ntype LocalMethod = (typeof localMethods)[number];\n\nexport function createLocalClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;\n\nexport function createLocalClient(\n params: CreateInnerClientParams,\n): InnerWalletApiClient {\n const { chain, transport, policyId, account } = params;\n const isomorphicClient = createIsomorphicClient({\n transport,\n chain,\n policyId,\n useErc7677middleware: false,\n });\n\n const clientMap: Record<string, ReturnType<typeof createIsomorphicClient>> = {\n [policyId ?? \"default\"]: isomorphicClient,\n };\n\n const innerTransport = split({\n overrides: [\n {\n methods: localMethods,\n transport: custom({\n // 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 ],\n fallback: transport,\n });\n\n return createClient({\n transport: innerTransport,\n chain,\n account,\n }).extend(() => ({\n policyId,\n ...innerClientActions(isomorphicClient),\n }));\n}\n\nconst innerClientActions = (\n isomorphicClient: IsomorphicClient,\n): InnerClientActions => {\n return {\n grantPermissions: async (signer, params) => {\n const { signatureRequest, fullPreSignatureDeferredActionDigest } =\n await isomorphicClient.createSession(params);\n\n const { signature } = await signSignatureRequest(\n signer,\n signatureRequest,\n );\n\n return {\n context: encodePermissionsContext({\n contextVersion: \"LOCAL_MODE_DEFERRED_ACTION\",\n deferredAction: buildDeferredActionDigest({\n fullPreSignatureDeferredActionDigest,\n sig: prefixSignatureKeyType(signature, \"secp256k1\"),\n }),\n }),\n };\n },\n };\n};\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/local/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,EAAqC,MAAM,MAAM,CAAC;AAC/E,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EACL,sBAAsB,GAEvB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,YAAY,GAAG;IACnB,qBAAqB;IACrB,0BAA0B;IAC1B,uBAAuB;IACvB,sBAAsB;CACK,CAAC;AAS9B,MAAM,UAAU,iBAAiB,CAC/B,MAA+B;IAE/B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACv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,CAAC,CAAC","sourcesContent":["import { split } from \"@aa-sdk/core\";\nimport { buildDeferredActionDigest } from \"@account-kit/smart-contracts/experimental\";\nimport { createClient, custom, type Address, type JsonRpcAccount } from \"viem\";\nimport {\n encodePermissionsContext,\n prefixSignatureKeyType,\n} from \"../capabilities/permissions/mav2.js\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport type { PrepareCallsParams } from \"../isomorphic/actions/prepareCalls.ts\";\nimport {\n createIsomorphicClient,\n type IsomorphicClient,\n} from \"../isomorphic/client.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n} from \"../types.ts\";\nimport { assertNever } from \"../utils.js\";\n\nconst localMethods = [\n \"wallet_prepareCalls\",\n \"wallet_sendPreparedCalls\",\n \"wallet_getCallsStatus\",\n \"wallet_createSession\",\n] as const satisfies string[];\ntype LocalMethod = (typeof localMethods)[number];\n\nexport function createLocalClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;\n\nexport function createLocalClient(\n params: CreateInnerClientParams,\n): InnerWalletApiClient {\n const { chain, transport, policyId, account } = params;\n const isomorphicClient = createIsomorphicClient({\n transport,\n chain,\n policyId,\n useErc7677middleware: false,\n });\n\n const clientMap: Record<string, ReturnType<typeof createIsomorphicClient>> = {\n [policyId ?? \"default\"]: isomorphicClient,\n };\n\n const innerTransport = split({\n overrides: [\n {\n methods: localMethods,\n transport: custom(\n {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async request(args: { method: LocalMethod; params: any }) {\n switch (args.method) {\n case \"wallet_prepareCalls\": {\n const params = args.params[0] as PrepareCallsParams;\n const capabilityPolicyId =\n params.capabilities?.paymasterService?.policyId;\n\n if (\n capabilityPolicyId != null &&\n policyId !== capabilityPolicyId &&\n !clientMap[capabilityPolicyId]\n ) {\n clientMap[capabilityPolicyId] = createIsomorphicClient({\n transport,\n chain,\n policyId: capabilityPolicyId,\n });\n }\n\n const client =\n clientMap[capabilityPolicyId ?? policyId ?? \"default\"];\n return client.prepareCalls(params);\n }\n case \"wallet_sendPreparedCalls\":\n return isomorphicClient.sendPreparedCalls(args.params[0]);\n case \"wallet_getCallsStatus\":\n return isomorphicClient.getCallsStatus(args.params[0]);\n case \"wallet_createSession\": {\n return isomorphicClient.createSession(args.params[0]);\n }\n default:\n return assertNever(\n args.method,\n `Unexpected method: ${args.method}`,\n );\n }\n },\n },\n {\n retryCount: 0,\n },\n ),\n },\n ],\n fallback: transport,\n });\n\n return createClient({\n transport: innerTransport,\n chain,\n account,\n })\n .extend(() => ({\n policyId,\n ...innerClientActions(isomorphicClient),\n }))\n .extend(() => ({\n internal: internalStateDecorator(),\n }));\n}\n\nconst innerClientActions = (\n isomorphicClient: IsomorphicClient,\n): InnerClientActions => {\n return {\n grantPermissions: async (signer, params) => {\n const { signatureRequest, fullPreSignatureDeferredActionDigest } =\n await isomorphicClient.createSession(params);\n\n const { signature } = await signSignatureRequest(\n signer,\n signatureRequest,\n );\n\n return {\n context: encodePermissionsContext({\n contextVersion: \"LOCAL_MODE_DEFERRED_ACTION\",\n deferredAction: buildDeferredActionDigest({\n fullPreSignatureDeferredActionDigest,\n sig: prefixSignatureKeyType(signature, \"secp256k1\"),\n }),\n }),\n };\n },\n };\n};\n"]}
@@ -1,3 +1,3 @@
1
1
  import { type Address, type JsonRpcAccount } from "viem";
2
- import type { CreateInnerClientParams, InnerWalletApiClient } from "../types";
2
+ import type { CreateInnerClientParams, InnerWalletApiClient } from "../types.ts";
3
3
  export declare function createRemoteClient<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;
@@ -1,8 +1,9 @@
1
1
  import { Provider } from "ox";
2
2
  import { createClient, custom } from "viem";
3
- import { WalletServerRpcSchema } from "../rpc/schema";
4
- import { signSignatureRequest } from "../client/actions/signSignatureRequest";
5
- import { encodePermissionsContext } from "../capabilities/permissions/mav2";
3
+ import { encodePermissionsContext } from "../capabilities/permissions/mav2.js";
4
+ import { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
5
+ import { internalStateDecorator } from "../internal/decorator.js";
6
+ import { WalletServerRpcSchema } from "../rpc/schema.js";
6
7
  /**
7
8
  * This is a low-level client just used to make RPC requests in remote mode
8
9
  * This should be wrapped by a higher-level smart account client that provides actions
@@ -15,9 +16,13 @@ export function createRemoteClient(params) {
15
16
  transport: (opts) => custom(Provider.from(transport(opts), { schema: WalletServerRpcSchema }))(opts),
16
17
  chain,
17
18
  account,
18
- }).extend((_client) => ({
19
+ })
20
+ .extend((_client) => ({
19
21
  policyId: params.policyId,
20
22
  ...innerClientActions(_client),
23
+ }))
24
+ .extend(() => ({
25
+ internal: internalStateDecorator(),
21
26
  }));
22
27
  return client;
23
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/remote/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAqC,MAAM,MAAM,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAOtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAQ5E;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAA+B;IAE/B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAE7C,MAAM,MAAM,GAAG,YAAY,CAAC;QAC1B,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAClB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC,CACvE,IAAI,CACL;QACH,KAAK;QACL,OAAO;KACR,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,GAAG,kBAAkB,CAAC,OAAO,CAAC;KAC/B,CAAC,CAAC,CAAC;IAEJ,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,kBAAkB,GAAG,CACzB,SAAmC,EACf,EAAE;IACtB,OAAO;QACL,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC;gBAC9D,MAAM,EAAE,sBAAsB;gBAC9B,MAAM,EAAE,CAAC,MAAM,CAAC;aACjB,CAAC,CAAC;YACH,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,oBAAoB,CAC9C,MAAM,EACN,gBAAgB,CACjB,CAAC;YACF,OAAO;gBACL,OAAO,EAAE,wBAAwB,CAAC;oBAChC,cAAc,EAAE,6BAA6B;oBAC7C,SAAS;oBACT,SAAS;iBACV,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Provider } from \"ox\";\nimport { createClient, custom, type Address, type JsonRpcAccount } from \"viem\";\nimport { WalletServerRpcSchema } from \"../rpc/schema\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n InnerWalletApiClientBase,\n} from \"../types\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest\";\nimport { encodePermissionsContext } from \"../capabilities/permissions/mav2\";\n\nexport function createRemoteClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;\n\n/**\n * This is a low-level client just used to make RPC requests in remote mode\n * This should be wrapped by a higher-level smart account client that provides actions\n * that uses this client under the hood\n * @returns\n */\nexport function createRemoteClient(\n params: CreateInnerClientParams,\n): InnerWalletApiClient {\n const { transport, chain, account } = params;\n\n const client = createClient({\n transport: (opts) =>\n custom(Provider.from(transport(opts), { schema: WalletServerRpcSchema }))(\n opts,\n ),\n chain,\n account,\n }).extend((_client) => ({\n policyId: params.policyId,\n ...innerClientActions(_client),\n }));\n\n return client;\n}\n\nconst innerClientActions = (\n apiClient: InnerWalletApiClientBase,\n): InnerClientActions => {\n return {\n grantPermissions: async (signer, params) => {\n const { sessionId, signatureRequest } = await apiClient.request({\n method: \"wallet_createSession\",\n params: [params],\n });\n const { signature } = await signSignatureRequest(\n signer,\n signatureRequest,\n );\n return {\n context: encodePermissionsContext({\n contextVersion: \"REMOTE_MODE_DEFERRED_ACTION\",\n sessionId,\n signature,\n }),\n };\n },\n };\n};\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/remote/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAqC,MAAM,MAAM,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAczD;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAA+B;IAE/B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAE7C,MAAM,MAAM,GAAG,YAAY,CAAC;QAC1B,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAClB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC,CACvE,IAAI,CACL;QACH,KAAK;QACL,OAAO;KACR,CAAC;SACC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,GAAG,kBAAkB,CAAC,OAAO,CAAC;KAC/B,CAAC,CAAC;SACF,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACb,QAAQ,EAAE,sBAAsB,EAAE;KACnC,CAAC,CAAC,CAAC;IAEN,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,kBAAkB,GAAG,CACzB,SAAmC,EACf,EAAE;IACtB,OAAO;QACL,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC;gBAC9D,MAAM,EAAE,sBAAsB;gBAC9B,MAAM,EAAE,CAAC,MAAM,CAAC;aACjB,CAAC,CAAC;YACH,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,oBAAoB,CAC9C,MAAM,EACN,gBAAgB,CACjB,CAAC;YACF,OAAO;gBACL,OAAO,EAAE,wBAAwB,CAAC;oBAChC,cAAc,EAAE,6BAA6B;oBAC7C,SAAS;oBACT,SAAS;iBACV,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Provider } from \"ox\";\nimport { createClient, custom, type Address, type JsonRpcAccount } from \"viem\";\nimport { encodePermissionsContext } from \"../capabilities/permissions/mav2.js\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport { WalletServerRpcSchema } from \"../rpc/schema.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n InnerWalletApiClientBase,\n} from \"../types.ts\";\n\nexport function createRemoteClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;\n\n/**\n * This is a low-level client just used to make RPC requests in remote mode\n * This should be wrapped by a higher-level smart account client that provides actions\n * that uses this client under the hood\n * @returns\n */\nexport function createRemoteClient(\n params: CreateInnerClientParams,\n): InnerWalletApiClient {\n const { transport, chain, account } = params;\n\n const client = createClient({\n transport: (opts) =>\n custom(Provider.from(transport(opts), { schema: WalletServerRpcSchema }))(\n opts,\n ),\n chain,\n account,\n })\n .extend((_client) => ({\n policyId: params.policyId,\n ...innerClientActions(_client),\n }))\n .extend(() => ({\n internal: internalStateDecorator(),\n }));\n\n return client;\n}\n\nconst innerClientActions = (\n apiClient: InnerWalletApiClientBase,\n): InnerClientActions => {\n return {\n grantPermissions: async (signer, params) => {\n const { sessionId, signatureRequest } = await apiClient.request({\n method: \"wallet_createSession\",\n params: [params],\n });\n const { signature } = await signSignatureRequest(\n signer,\n signatureRequest,\n );\n return {\n context: encodePermissionsContext({\n contextVersion: \"REMOTE_MODE_DEFERRED_ACTION\",\n sessionId,\n signature,\n }),\n };\n },\n };\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  import { Type } from "@sinclair/typebox";
2
- import { Capabilities } from "../capabilities";
3
- import { PermissionsContext, PermissionsData, } from "../capabilities/permissions";
4
- import { TypeAddress, TypeBase64UrlEncodedString, TypeCreationOptions, TypeHex, TypeSerializedInitcode, TypeSignatureRequest, TypeUserOperationRequest_v6, TypeUserOperationRequest_v7, TypeUuid, } from "../schemas";
2
+ import { Capabilities } from "../capabilities/index.js";
3
+ import { PermissionsContext, PermissionsData, } from "../capabilities/permissions/index.js";
4
+ import { TypeAddress, TypeBase64UrlEncodedString, TypeCreationOptions, TypeHex, TypeSerializedInitcode, TypeSignatureRequest, TypeUserOperationRequest_v6, TypeUserOperationRequest_v7, TypeUuid, } from "../schemas.js";
5
5
  export const wallet_sendPreparedCalls = Type.Object({
6
6
  Request: Type.Object({
7
7
  method: Type.Literal("wallet_sendPreparedCalls"),
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/rpc/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,WAAW,EACX,0BAA0B,EAC1B,mBAAmB,EACnB,OAAO,EACP,sBAAsB,EACtB,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,MAAM,CACjD;IACE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC;QACnB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC;QAChD,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC;YACjB,IAAI,CAAC,MAAM,CAAC;gBACV,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;oBACf,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;oBACnC,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;iBACpC,CAAC;gBACF,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;oBACf,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,WAAW,CAAC,CAAC;oBACrD,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,WAAW,CAAC,CAAC;iBACtD,CAAC;gBACF,OAAO,EAAE,OAAO,EAAE;gBAClB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;yBAChC,MAAM,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AAU,EAAE,IAAI,CAAC,MAAM,CAAC;QACtB,EAAE,EAAE,OAAO,EAAE;QACb,OAAO,EAAE,OAAO,EAAE;QAClB,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE;QACtB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,+EAA+E;aAClF,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,4FAA4F;aAC/F,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,+DAA+D;aAClE,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,mGAAmG;aACtG,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,mGAAmG;aACtG,CAAC;SACH,CAAC;QACF,QAAQ,EAAE,IAAI,CAAC,QAAQ,CACrB,IAAI,CAAC,KAAK,CACR,IAAI,CAAC,MAAM,CAAC;YACV,IAAI,EAAE,IAAI,CAAC,KAAK,CACd,IAAI,CAAC,MAAM,CAAC;gBACV,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,OAAO,EAAE;gBACf,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;aAC9B,CAAC,CACH;YACD,MAAM,EAAE,OAAO,CAAC;gBACd,WAAW,EAAE,kCAAkC;aAChD,CAAC;YACF,SAAS,EAAE,OAAO,EAAE;YACpB,WAAW,EAAE,OAAO,EAAE;YACtB,OAAO,EAAE,OAAO,EAAE;YAClB,eAAe,EAAE,OAAO,EAAE;SAC3B,CAAC,CACH,CACF;KACF,CAAC;CACH,EACD;IACE,WAAW,EACT,4FAA4F;CAC/F,CACF,CAAC","sourcesContent":["import { Type } from \"@sinclair/typebox\";\nimport { Capabilities } from \"../capabilities\";\nimport {\n PermissionsContext,\n PermissionsData,\n} from \"../capabilities/permissions\";\nimport {\n TypeAddress,\n TypeBase64UrlEncodedString,\n TypeCreationOptions,\n TypeHex,\n TypeSerializedInitcode,\n TypeSignatureRequest,\n TypeUserOperationRequest_v6,\n TypeUserOperationRequest_v7,\n TypeUuid,\n} from \"../schemas\";\n\nexport const wallet_sendPreparedCalls = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_sendPreparedCalls\"),\n params: Type.Tuple([\n Type.Object({\n type: Type.Union([\n Type.Literal(\"user-operation-v060\"),\n Type.Literal(\"user-operation-v070\"),\n ]),\n data: Type.Union([\n Type.Omit(TypeUserOperationRequest_v6, [\"signature\"]),\n Type.Omit(TypeUserOperationRequest_v7, [\"signature\"]),\n ]),\n chainId: TypeHex(),\n signature: Type.Object({\n type: Type.Transform(Type.String())\n .Decode((value) => {\n if (value.toLowerCase() !== \"ecdsa\") {\n throw new Error(\"Invalid signature type, must be 'ecdsa'\");\n }\n\n return \"ecdsa\" as const;\n })\n .Encode((value) => value),\n signature: TypeHex(),\n }),\n capabilities: Type.Optional(\n Type.Object({ permissions: PermissionsContext }),\n ),\n }),\n ]),\n }),\n ReturnType: Type.Object({\n preparedCallIds: Type.Array(TypeHex()),\n }),\n },\n {\n description:\n \"This method is used after signing the signatureRequest returned from prepareCalls to submit a user operation\",\n },\n);\n\nexport const wallet_prepareCalls = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_prepareCalls\"),\n params: Type.Tuple([\n Type.Object({\n calls: Type.Array(\n Type.Object({\n to: TypeAddress,\n data: Type.Optional(TypeHex()),\n value: Type.Optional(TypeHex()),\n }),\n ),\n from: TypeAddress,\n chainId: TypeHex(),\n capabilities: Type.Optional(Capabilities),\n }),\n ]),\n }),\n ReturnType: Type.Object({\n type: Type.Union([\n Type.Literal(\"user-operation-v060\"),\n Type.Literal(\"user-operation-v070\"),\n ]),\n data: Type.Union([\n Type.Omit(TypeUserOperationRequest_v6, [\"signature\"]),\n Type.Omit(TypeUserOperationRequest_v7, [\"signature\"]),\n ]),\n chainId: TypeHex(),\n signatureRequest: TypeSignatureRequest,\n }),\n },\n {\n description:\n \"This method is used to prepare a user operation for submission. It will return a built user operation and a signature request which needs to be signed by the user before submitting to wallet_sendPreparedCalls\",\n },\n);\n\nexport const wallet_requestAccount = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_requestAccount\"),\n params: Type.Tuple([\n Type.Union([\n Type.Object({\n signerAddress: TypeAddress,\n id: Type.Optional(TypeUuid),\n creationHint: TypeCreationOptions,\n includeCounterfactualInfo: Type.Optional(\n Type.Boolean({ default: false }),\n ),\n }),\n Type.Object({\n accountAddress: TypeAddress,\n includeCounterfactualInfo: Type.Optional(\n Type.Boolean({ default: false }),\n ),\n }),\n ]),\n ]),\n }),\n ReturnType: Type.Object({\n accountAddress: TypeAddress,\n id: TypeUuid,\n counterfactualInfo: Type.Optional(TypeSerializedInitcode),\n }),\n },\n {\n description: `This method is used to get the smart account address and relevant info for a given signer. If an account does not already exist for a given signer, this method will create one before returning the counterfactual address.`,\n },\n);\n\nexport const wallet_createAccount = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_createAccount\"),\n params: Type.Tuple([\n Type.Object({\n signerAddress: TypeAddress,\n id: Type.Optional(TypeUuid),\n creationOptions: TypeCreationOptions,\n }),\n ]),\n }),\n ReturnType: Type.Object({\n accountAddress: TypeAddress,\n id: TypeUuid,\n }),\n },\n {\n description: `This method is used to create a smart account for a given signer. This method is primarly used to import existing accounts. For most cases, you should use wallet_requestAccount instead.`,\n },\n);\n\nexport const wallet_listAccounts = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_listAccounts\"),\n params: Type.Tuple([\n Type.Object({\n signerAddress: TypeAddress,\n limit: Type.Optional(\n Type.Number({ minimum: 1, maximum: 100, default: 100 }),\n ),\n after: Type.Optional(TypeBase64UrlEncodedString),\n }),\n ]),\n }),\n ReturnType: Type.Object({\n accounts: Type.Array(\n Type.Object({\n accountAddress: TypeAddress,\n id: TypeUuid,\n }),\n ),\n meta: Type.Object({\n totalCount: Type.Number(),\n after: Type.Union([TypeBase64UrlEncodedString, Type.Null()]),\n }),\n }),\n },\n {\n description:\n \"This method is used to list all smart accounts for a given signer.\",\n },\n);\n\nexport const wallet_createSession = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_createSession\"),\n params: Type.Tuple([\n Type.Intersect([\n PermissionsData,\n Type.Object({ account: TypeAddress }),\n ]),\n ]),\n }),\n ReturnType: Type.Object({\n sessionId: TypeHex(),\n signatureRequest: TypeSignatureRequest,\n }),\n },\n {\n description:\n \"This method is used to create a session for a given address with specified permissions.\",\n },\n);\n\nexport const wallet_getCallsStatus = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_getCallsStatus\"),\n params: Type.Tuple([\n TypeHex({\n description: \"The call ID returned from wallet_sendPreparedCalls\",\n }),\n ]),\n }),\n ReturnType: Type.Object({\n id: TypeHex(),\n chainId: TypeHex(),\n atomic: Type.Boolean(),\n status: Type.Union([\n Type.Literal(100, {\n description:\n \"Batch has been received by the wallet but has not completed execution onchain\",\n }),\n Type.Literal(200, {\n description:\n \"Batch has been included onchain without reverts, receipts array contains info of all calls\",\n }),\n Type.Literal(400, {\n description:\n \"Batch has not been included onchain and wallet will not retry\",\n }),\n Type.Literal(500, {\n description:\n \"Batch reverted *completely* and only changes related to gas charge may have been included onchain\",\n }),\n Type.Literal(600, {\n description:\n \"Batch reverted *partially* and some changes related to batch calls may have been included onchain\",\n }),\n ]),\n receipts: Type.Optional(\n Type.Array(\n Type.Object({\n logs: Type.Array(\n Type.Object({\n address: TypeAddress,\n data: TypeHex(),\n topics: Type.Array(TypeHex()),\n }),\n ),\n status: TypeHex({\n description: \"0x1 for success, 0x0 for failure\",\n }),\n blockHash: TypeHex(),\n blockNumber: TypeHex(),\n gasUsed: TypeHex(),\n transactionHash: TypeHex(),\n }),\n ),\n ),\n }),\n },\n {\n description:\n \"This method is used to get the status of calls IDs returned from wallet_sendPreparedCalls.\",\n },\n);\n"]}
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/rpc/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACL,kBAAkB,EAClB,eAAe,GAChB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,WAAW,EACX,0BAA0B,EAC1B,mBAAmB,EACnB,OAAO,EACP,sBAAsB,EACtB,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,MAAM,CACjD;IACE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC;QACnB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC;QAChD,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC;YACjB,IAAI,CAAC,MAAM,CAAC;gBACV,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;oBACf,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;oBACnC,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;iBACpC,CAAC;gBACF,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;oBACf,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,WAAW,CAAC,CAAC;oBACrD,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,WAAW,CAAC,CAAC;iBACtD,CAAC;gBACF,OAAO,EAAE,OAAO,EAAE;gBAClB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;yBAChC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;wBAChB,IAAI,KAAK,CA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,OAAO,EAAE;QACb,OAAO,EAAE,OAAO,EAAE;QAClB,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE;QACtB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,+EAA+E;aAClF,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,4FAA4F;aAC/F,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,+DAA+D;aAClE,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,mGAAmG;aACtG,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,mGAAmG;aACtG,CAAC;SACH,CAAC;QACF,QAAQ,EAAE,IAAI,CAAC,QAAQ,CACrB,IAAI,CAAC,KAAK,CACR,IAAI,CAAC,MAAM,CAAC;YACV,IAAI,EAAE,IAAI,CAAC,KAAK,CACd,IAAI,CAAC,MAAM,CAAC;gBACV,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,OAAO,EAAE;gBACf,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;aAC9B,CAAC,CACH;YACD,MAAM,EAAE,OAAO,CAAC;gBACd,WAAW,EAAE,kCAAkC;aAChD,CAAC;YACF,SAAS,EAAE,OAAO,EAAE;YACpB,WAAW,EAAE,OAAO,EAAE;YACtB,OAAO,EAAE,OAAO,EAAE;YAClB,eAAe,EAAE,OAAO,EAAE;SAC3B,CAAC,CACH,CACF;KACF,CAAC;CACH,EACD;IACE,WAAW,EACT,4FAA4F;CAC/F,CACF,CAAC","sourcesContent":["import { Type } from \"@sinclair/typebox\";\nimport { Capabilities } from \"../capabilities/index.js\";\nimport {\n PermissionsContext,\n PermissionsData,\n} from \"../capabilities/permissions/index.js\";\nimport {\n TypeAddress,\n TypeBase64UrlEncodedString,\n TypeCreationOptions,\n TypeHex,\n TypeSerializedInitcode,\n TypeSignatureRequest,\n TypeUserOperationRequest_v6,\n TypeUserOperationRequest_v7,\n TypeUuid,\n} from \"../schemas.js\";\n\nexport const wallet_sendPreparedCalls = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_sendPreparedCalls\"),\n params: Type.Tuple([\n Type.Object({\n type: Type.Union([\n Type.Literal(\"user-operation-v060\"),\n Type.Literal(\"user-operation-v070\"),\n ]),\n data: Type.Union([\n Type.Omit(TypeUserOperationRequest_v6, [\"signature\"]),\n Type.Omit(TypeUserOperationRequest_v7, [\"signature\"]),\n ]),\n chainId: TypeHex(),\n signature: Type.Object({\n type: Type.Transform(Type.String())\n .Decode((value) => {\n if (value.toLowerCase() !== \"ecdsa\") {\n throw new Error(\"Invalid signature type, must be 'ecdsa'\");\n }\n\n return \"ecdsa\" as const;\n })\n .Encode((value) => value),\n signature: TypeHex(),\n }),\n capabilities: Type.Optional(\n Type.Object({ permissions: PermissionsContext }),\n ),\n }),\n ]),\n }),\n ReturnType: Type.Object({\n preparedCallIds: Type.Array(TypeHex()),\n }),\n },\n {\n description:\n \"This method is used after signing the signatureRequest returned from prepareCalls to submit a user operation\",\n },\n);\n\nexport const wallet_prepareCalls = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_prepareCalls\"),\n params: Type.Tuple([\n Type.Object({\n calls: Type.Array(\n Type.Object({\n to: TypeAddress,\n data: Type.Optional(TypeHex()),\n value: Type.Optional(TypeHex()),\n }),\n ),\n from: TypeAddress,\n chainId: TypeHex(),\n capabilities: Type.Optional(Capabilities),\n }),\n ]),\n }),\n ReturnType: Type.Object({\n type: Type.Union([\n Type.Literal(\"user-operation-v060\"),\n Type.Literal(\"user-operation-v070\"),\n ]),\n data: Type.Union([\n Type.Omit(TypeUserOperationRequest_v6, [\"signature\"]),\n Type.Omit(TypeUserOperationRequest_v7, [\"signature\"]),\n ]),\n chainId: TypeHex(),\n signatureRequest: TypeSignatureRequest,\n }),\n },\n {\n description:\n \"This method is used to prepare a user operation for submission. It will return a built user operation and a signature request which needs to be signed by the user before submitting to wallet_sendPreparedCalls\",\n },\n);\n\nexport const wallet_requestAccount = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_requestAccount\"),\n params: Type.Tuple([\n Type.Union([\n Type.Object({\n signerAddress: TypeAddress,\n id: Type.Optional(TypeUuid),\n creationHint: TypeCreationOptions,\n includeCounterfactualInfo: Type.Optional(\n Type.Boolean({ default: false }),\n ),\n }),\n Type.Object({\n accountAddress: TypeAddress,\n includeCounterfactualInfo: Type.Optional(\n Type.Boolean({ default: false }),\n ),\n }),\n ]),\n ]),\n }),\n ReturnType: Type.Object({\n accountAddress: TypeAddress,\n id: TypeUuid,\n counterfactualInfo: Type.Optional(TypeSerializedInitcode),\n }),\n },\n {\n description: `This method is used to get the smart account address and relevant info for a given signer. If an account does not already exist for a given signer, this method will create one before returning the counterfactual address.`,\n },\n);\n\nexport const wallet_createAccount = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_createAccount\"),\n params: Type.Tuple([\n Type.Object({\n signerAddress: TypeAddress,\n id: Type.Optional(TypeUuid),\n creationOptions: TypeCreationOptions,\n }),\n ]),\n }),\n ReturnType: Type.Object({\n accountAddress: TypeAddress,\n id: TypeUuid,\n }),\n },\n {\n description: `This method is used to create a smart account for a given signer. This method is primarly used to import existing accounts. For most cases, you should use wallet_requestAccount instead.`,\n },\n);\n\nexport const wallet_listAccounts = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_listAccounts\"),\n params: Type.Tuple([\n Type.Object({\n signerAddress: TypeAddress,\n limit: Type.Optional(\n Type.Number({ minimum: 1, maximum: 100, default: 100 }),\n ),\n after: Type.Optional(TypeBase64UrlEncodedString),\n }),\n ]),\n }),\n ReturnType: Type.Object({\n accounts: Type.Array(\n Type.Object({\n accountAddress: TypeAddress,\n id: TypeUuid,\n }),\n ),\n meta: Type.Object({\n totalCount: Type.Number(),\n after: Type.Union([TypeBase64UrlEncodedString, Type.Null()]),\n }),\n }),\n },\n {\n description:\n \"This method is used to list all smart accounts for a given signer.\",\n },\n);\n\nexport const wallet_createSession = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_createSession\"),\n params: Type.Tuple([\n Type.Intersect([\n PermissionsData,\n Type.Object({ account: TypeAddress }),\n ]),\n ]),\n }),\n ReturnType: Type.Object({\n sessionId: TypeHex(),\n signatureRequest: TypeSignatureRequest,\n }),\n },\n {\n description:\n \"This method is used to create a session for a given address with specified permissions.\",\n },\n);\n\nexport const wallet_getCallsStatus = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_getCallsStatus\"),\n params: Type.Tuple([\n TypeHex({\n description: \"The call ID returned from wallet_sendPreparedCalls\",\n }),\n ]),\n }),\n ReturnType: Type.Object({\n id: TypeHex(),\n chainId: TypeHex(),\n atomic: Type.Boolean(),\n status: Type.Union([\n Type.Literal(100, {\n description:\n \"Batch has been received by the wallet but has not completed execution onchain\",\n }),\n Type.Literal(200, {\n description:\n \"Batch has been included onchain without reverts, receipts array contains info of all calls\",\n }),\n Type.Literal(400, {\n description:\n \"Batch has not been included onchain and wallet will not retry\",\n }),\n Type.Literal(500, {\n description:\n \"Batch reverted *completely* and only changes related to gas charge may have been included onchain\",\n }),\n Type.Literal(600, {\n description:\n \"Batch reverted *partially* and some changes related to batch calls may have been included onchain\",\n }),\n ]),\n receipts: Type.Optional(\n Type.Array(\n Type.Object({\n logs: Type.Array(\n Type.Object({\n address: TypeAddress,\n data: TypeHex(),\n topics: Type.Array(TypeHex()),\n }),\n ),\n status: TypeHex({\n description: \"0x1 for success, 0x0 for failure\",\n }),\n blockHash: TypeHex(),\n blockNumber: TypeHex(),\n gasUsed: TypeHex(),\n transactionHash: TypeHex(),\n }),\n ),\n ),\n }),\n },\n {\n description:\n \"This method is used to get the status of calls IDs returned from wallet_sendPreparedCalls.\",\n },\n);\n"]}
@@ -263,6 +263,7 @@ export declare const WalletServerRpcSchema: {
263
263
  method: "wallet_createSession";
264
264
  };
265
265
  ReturnType: {
266
+ sessionId: `0x${string}`;
266
267
  signatureRequest: {
267
268
  type: "personal_sign";
268
269
  data: string | {
@@ -290,7 +291,6 @@ export declare const WalletServerRpcSchema: {
290
291
  };
291
292
  };
292
293
  };
293
- sessionId: `0x${string}`;
294
294
  };
295
295
  } | {
296
296
  Request: {
@@ -1,5 +1,5 @@
1
1
  import {} from "@sinclair/typebox";
2
2
  import { RpcSchema } from "ox";
3
- import * as Requests from "./request";
3
+ import * as Requests from "./request.js";
4
4
  export const WalletServerRpcSchema = RpcSchema.from();
5
5
  //# sourceMappingURL=schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/rpc/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAEtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC,IAAI,EAQhD,CAAC","sourcesContent":["import { type Static, type StaticDecode } from \"@sinclair/typebox\";\nimport { RpcSchema } from \"ox\";\nimport * as Requests from \"./request\";\n\nexport const WalletServerRpcSchema = RpcSchema.from<\n | Static<typeof Requests.wallet_prepareCalls>\n | StaticDecode<typeof Requests.wallet_sendPreparedCalls>\n | Static<typeof Requests.wallet_createAccount>\n | Static<typeof Requests.wallet_requestAccount>\n | Static<typeof Requests.wallet_listAccounts>\n | Static<typeof Requests.wallet_createSession>\n | Static<typeof Requests.wallet_getCallsStatus>\n>();\n\nexport type WalletServerRpcSchemaType = typeof WalletServerRpcSchema;\n\ntype MethodToViemRpcSchema = {\n [K in WalletServerRpcSchemaType[\"Request\"][\"method\"]]: {\n Method: K;\n Parameters: Extract<\n WalletServerRpcSchemaType[\"Request\"],\n { method: K }\n >[\"params\"];\n ReturnType: Extract<\n WalletServerRpcSchemaType,\n { Request: { method: K } }\n >[\"ReturnType\"];\n };\n};\n\n// TODO: figure out how we can do this without manually listing all the methods\nexport type WalletServerViemRpcSchema = [\n MethodToViemRpcSchema[\"wallet_createAccount\"],\n MethodToViemRpcSchema[\"wallet_requestAccount\"],\n MethodToViemRpcSchema[\"wallet_listAccounts\"],\n MethodToViemRpcSchema[\"wallet_prepareCalls\"],\n MethodToViemRpcSchema[\"wallet_sendPreparedCalls\"],\n MethodToViemRpcSchema[\"wallet_getCallsStatus\"],\n MethodToViemRpcSchema[\"wallet_createSession\"],\n];\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/rpc/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,cAAc,CAAC;AAEzC,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC,IAAI,EAQhD,CAAC","sourcesContent":["import { type Static, type StaticDecode } from \"@sinclair/typebox\";\nimport { RpcSchema } from \"ox\";\nimport * as Requests from \"./request.js\";\n\nexport const WalletServerRpcSchema = RpcSchema.from<\n | Static<typeof Requests.wallet_prepareCalls>\n | StaticDecode<typeof Requests.wallet_sendPreparedCalls>\n | Static<typeof Requests.wallet_createAccount>\n | Static<typeof Requests.wallet_requestAccount>\n | Static<typeof Requests.wallet_listAccounts>\n | Static<typeof Requests.wallet_createSession>\n | Static<typeof Requests.wallet_getCallsStatus>\n>();\n\nexport type WalletServerRpcSchemaType = typeof WalletServerRpcSchema;\n\ntype MethodToViemRpcSchema = {\n [K in WalletServerRpcSchemaType[\"Request\"][\"method\"]]: {\n Method: K;\n Parameters: Extract<\n WalletServerRpcSchemaType[\"Request\"],\n { method: K }\n >[\"params\"];\n ReturnType: Extract<\n WalletServerRpcSchemaType,\n { Request: { method: K } }\n >[\"ReturnType\"];\n };\n};\n\n// TODO: figure out how we can do this without manually listing all the methods\nexport type WalletServerViemRpcSchema = [\n MethodToViemRpcSchema[\"wallet_createAccount\"],\n MethodToViemRpcSchema[\"wallet_requestAccount\"],\n MethodToViemRpcSchema[\"wallet_listAccounts\"],\n MethodToViemRpcSchema[\"wallet_prepareCalls\"],\n MethodToViemRpcSchema[\"wallet_sendPreparedCalls\"],\n MethodToViemRpcSchema[\"wallet_getCallsStatus\"],\n MethodToViemRpcSchema[\"wallet_createSession\"],\n];\n"]}
@@ -1,8 +1,9 @@
1
+ import type { SmartAccountSigner, SmartContractAccount } from "@aa-sdk/core";
1
2
  import type { AlchemyTransport } from "@account-kit/infra";
2
3
  import type { Address, Chain, Client, Hex, IsUndefined, JsonRpcAccount, Transport } from "viem";
3
- import type { WalletServerViemRpcSchema } from "./rpc/schema";
4
- import type { SmartAccountSigner } from "@aa-sdk/core";
5
- import type { GrantPermissionsParams, GrantPermissionsResult } from "./client/actions/grantPermissions";
4
+ import type { GrantPermissionsParams, GrantPermissionsResult } from "./client/actions/grantPermissions.ts";
5
+ import type { RequestAccountParams } from "./client/actions/requestAccount.ts";
6
+ import type { WalletServerViemRpcSchema } from "./rpc/schema.ts";
6
7
  export type CreateInnerClientParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = {
7
8
  chain: Chain;
8
9
  transport: AlchemyTransport;
@@ -24,4 +25,14 @@ export type InnerClientActions = {
24
25
  chainId: Hex;
25
26
  }) => Promise<GrantPermissionsResult>;
26
27
  };
27
- export type InnerWalletApiClient<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = InnerWalletApiClientBase<TAccount, InnerClientActions>;
28
+ export type CachedAccount = {
29
+ account: SmartContractAccount;
30
+ requestParams: RequestAccountParams;
31
+ };
32
+ export type InternalState = {
33
+ setAccount: (account: CachedAccount) => void;
34
+ getAccount: () => CachedAccount | undefined;
35
+ };
36
+ export type InnerWalletApiClient<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = InnerWalletApiClientBase<TAccount, InnerClientActions & {
37
+ internal: InternalState;
38
+ }>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AlchemyTransport } from \"@account-kit/infra\";\nimport type {\n Address,\n Chain,\n Client,\n Hex,\n IsUndefined,\n JsonRpcAccount,\n Transport,\n} from \"viem\";\nimport type { WalletServerViemRpcSchema } from \"./rpc/schema\";\nimport type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type {\n GrantPermissionsParams,\n GrantPermissionsResult,\n} from \"./client/actions/grantPermissions\";\n\nexport type CreateInnerClientParams<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = {\n chain: Chain;\n transport: AlchemyTransport;\n policyId?: string;\n} & (IsUndefined<TAccount> extends true\n ? {\n account?: never;\n }\n : {\n account: Address;\n });\n\nexport type InnerWalletApiClientBase<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n TExtend extends { [key: string]: unknown } | undefined =\n | { [key: string]: unknown }\n | undefined,\n> = Client<\n Transport,\n Chain,\n TAccount,\n WalletServerViemRpcSchema,\n { policyId?: string } & TExtend\n>;\n\nexport type InnerClientActions = {\n grantPermissions: (\n signer: SmartAccountSigner,\n params: GrantPermissionsParams & { chainId: Hex },\n ) => Promise<GrantPermissionsResult>;\n};\n\nexport type InnerWalletApiClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = InnerWalletApiClientBase<TAccount, InnerClientActions>;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SmartAccountSigner, SmartContractAccount } from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"@account-kit/infra\";\nimport type {\n Address,\n Chain,\n Client,\n Hex,\n IsUndefined,\n JsonRpcAccount,\n Transport,\n} from \"viem\";\nimport type {\n GrantPermissionsParams,\n GrantPermissionsResult,\n} from \"./client/actions/grantPermissions.ts\";\nimport type { RequestAccountParams } from \"./client/actions/requestAccount.ts\";\nimport type { WalletServerViemRpcSchema } from \"./rpc/schema.ts\";\n\nexport type CreateInnerClientParams<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = {\n chain: Chain;\n transport: AlchemyTransport;\n policyId?: string;\n} & (IsUndefined<TAccount> extends true\n ? {\n account?: never;\n }\n : {\n account: Address;\n });\n\nexport type InnerWalletApiClientBase<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n TExtend extends { [key: string]: unknown } | undefined =\n | { [key: string]: unknown }\n | undefined,\n> = Client<\n Transport,\n Chain,\n TAccount,\n WalletServerViemRpcSchema,\n { policyId?: string } & TExtend\n>;\n\nexport type InnerClientActions = {\n grantPermissions: (\n signer: SmartAccountSigner,\n params: GrantPermissionsParams & { chainId: Hex },\n ) => Promise<GrantPermissionsResult>;\n};\n\nexport type CachedAccount = {\n account: SmartContractAccount;\n requestParams: RequestAccountParams;\n};\n\nexport type InternalState = {\n setAccount: (account: CachedAccount) => void;\n getAccount: () => CachedAccount | undefined;\n};\n\nexport type InnerWalletApiClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = InnerWalletApiClientBase<\n TAccount,\n InnerClientActions & { internal: InternalState }\n>;\n"]}
@@ -1,9 +1,9 @@
1
- export { LightAccountFactoryAbi_V1_0_1 } from "./LightAccountFactoryAbi_V1_0_1";
2
- export { LightAccountFactoryAbi_V1_0_2 } from "./LightAccountFactoryAbi_V1_0_2";
3
- export { LightAccountFactoryAbi_V1_1_0 } from "./LightAccountFactoryAbi_V1_1_0";
4
- export { LightAccountFactoryAbi_V2_0_0 } from "./LightAccountFactoryAbi_V2_0_0";
5
- export { ModularAccountFactoryAbi_V2_0_0 } from "./ModularAccountFactoryAbi_V2_0_0";
6
- export { MultiOwnerLightAccountFactoryAbi_V2_0_0 } from "./MultiOwnerLightAccountFactoryAbi_V2_0_0";
7
- export { MultiOwnerModularAccountFactoryAbi_V1_0_0 } from "./MultiOwnerModularAccountFactoryAbi_V1_0_0";
8
- export { MultisigModularAccountFactoryAbi_V1_0_0 } from "./MultisigModularAccountFactoryAbi_V1_0_0";
1
+ export { LightAccountFactoryAbi_V1_0_1 } from "./LightAccountFactoryAbi_V1_0_1.js";
2
+ export { LightAccountFactoryAbi_V1_0_2 } from "./LightAccountFactoryAbi_V1_0_2.js";
3
+ export { LightAccountFactoryAbi_V1_1_0 } from "./LightAccountFactoryAbi_V1_1_0.js";
4
+ export { LightAccountFactoryAbi_V2_0_0 } from "./LightAccountFactoryAbi_V2_0_0.js";
5
+ export { ModularAccountFactoryAbi_V2_0_0 } from "./ModularAccountFactoryAbi_V2_0_0.js";
6
+ export { MultiOwnerLightAccountFactoryAbi_V2_0_0 } from "./MultiOwnerLightAccountFactoryAbi_V2_0_0.js";
7
+ export { MultiOwnerModularAccountFactoryAbi_V1_0_0 } from "./MultiOwnerModularAccountFactoryAbi_V1_0_0.js";
8
+ export { MultisigModularAccountFactoryAbi_V1_0_0 } from "./MultisigModularAccountFactoryAbi_V1_0_0.js";
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/abi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,uCAAuC,EAAE,MAAM,2CAA2C,CAAC;AACpG,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAC;AACxG,OAAO,EAAE,uCAAuC,EAAE,MAAM,2CAA2C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/abi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,uCAAuC,EAAE,MAAM,8CAA8C,CAAC;AACvG,OAAO,EAAE,yCAAyC,EAAE,MAAM,gDAAgD,CAAC;AAC3G,OAAO,EAAE,uCAAuC,EAAE,MAAM,8CAA8C,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { Static } from "@sinclair/typebox";
2
2
  import { type Hex } from "viem";
3
- import type { PermissionsData } from ".";
4
- import type { KeySigner } from "../../schemas";
3
+ import type { PermissionsData } from "./index.ts";
4
+ import type { KeySigner } from "../../schemas.ts";
5
5
  export declare const SESSION_ID_LENGTH_BYTES = 16;
6
6
  export declare const ENTITY_ID_LENGTH_BYTES = 4;
7
7
  export declare const PermissionsContextVersion: {
@@ -1 +1 @@
1
- {"version":3,"file":"mav2.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/permissions/mav2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAuB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,GAAG,CAAC;AACzC,OAAO,KAA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C"}
@@ -1,11 +1,36 @@
1
1
  import type { SmartAccountSigner } from "@aa-sdk/core";
2
2
  import type { Static } from "@sinclair/typebox";
3
3
  import type { Address } from "abitype";
4
- import type { wallet_createAccount } from "../../rpc/request";
5
- import type { InnerWalletApiClient } from "../../types";
4
+ import type { wallet_createAccount } from "../../rpc/request.ts";
5
+ import type { InnerWalletApiClient } from "../../types.ts";
6
6
  export type CreateAccountParams = Omit<Extract<Static<typeof wallet_createAccount>["Request"]["params"][0], {
7
7
  signerAddress: Address;
8
8
  }>, "signerAddress">;
9
9
  export type CreateAccountResult = Static<typeof wallet_createAccount>["ReturnType"];
10
+ /**
11
+ * Creates a new account for the provided signer using the wallet API client.
12
+ * This method is primarily used to import existing accounts.
13
+ * For most cases, you should use requestAccount instead.
14
+ * If the account already exists, an error will be thrown.
15
+ *
16
+ * @param {InnerWalletApiClient} client - The wallet API client to use for the request
17
+ * @param {SmartAccountSigner} signer - The signer that will be associated with the account
18
+ * @param {CreateAccountParams} params - Parameters for creating the account
19
+ * @param {string} [params.id] - Optional UUID v4 identifier for the account
20
+ * @param {object} params.creationOptions - Options for account creation
21
+ * @param {string} [params.creationOptions.accountType] - Currently only "sma-b" (Modular Account v2) is supported
22
+ * @param {string} [params.creationOptions.salt] - Optional hex string to use as salt for account creation
23
+ * @returns {Promise<CreateAccountResult>} A Promise that resolves to the created account information
24
+ *
25
+ * @example
26
+ * // Create a new account with a custom salt
27
+ * const account = await client.createAccount({
28
+ * creationOptions: {
29
+ * accountType: "sma-b",
30
+ * salt: "0x04"
31
+ * }
32
+ * });
33
+ * console.log(`Created account at address: ${account.accountAddress}`);
34
+ */
10
35
  export declare function createAccount(client: InnerWalletApiClient, signer: SmartAccountSigner, params: CreateAccountParams): Promise<CreateAccountResult>;
11
36
  //# sourceMappingURL=createAccount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/createAccount.ts"],"names":[],"mappings":"AAAA,OA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C,CAAC,EAC3D;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CAC3B,EACD,eAAe,CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC,OAAO,oBAAoB,CAC5B,CAAC,YAAY,CAAC,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAK9B"}
@@ -1,7 +1,26 @@
1
1
  import type { Address, JsonRpcAccount } from "viem";
2
- import type { GetCallsStatusParams as IsomorphicGetCallsStatusParams, GetCallsStatusResponse as IsomorphicGetCallsStatusResult } from "../../isomorphic/actions/getCallsStatus";
3
- import type { InnerWalletApiClient } from "../../types";
2
+ import type { GetCallsStatusParams as IsomorphicGetCallsStatusParams, GetCallsStatusResponse as IsomorphicGetCallsStatusResult } from "../../isomorphic/actions/getCallsStatus.ts";
3
+ import type { InnerWalletApiClient } from "../../types.ts";
4
4
  export type GetCallsStatusParams = IsomorphicGetCallsStatusParams;
5
5
  export type GetCallsStatusResult = IsomorphicGetCallsStatusResult;
6
+ /**
7
+ * Gets the status of a prepared call by its ID.
8
+ * This method is used to check the execution status of calls sent via sendPreparedCalls.
9
+ *
10
+ * @param {InnerWalletApiClient} client - The wallet API client to use for the request
11
+ * @param {GetCallsStatusParams} params - The ID of the prepared call to check
12
+ * @returns {Promise<GetCallsStatusResult>} A Promise that resolves to the status information including:
13
+ * - id: The hex ID of the call
14
+ * - chainId: The chain ID in hex format
15
+ * - status: The current status of the batch execution
16
+ * - receipts: Optional array of transaction receipts if the batch has been executed
17
+ *
18
+ * @example
19
+ * // After sending prepared calls
20
+ * const sendResult = await client.sendPreparedCalls({...});
21
+ *
22
+ * // Check the status of the first call ID
23
+ * const status = await client.getCallsStatus(sendResult.preparedCallIds[0]);
24
+ */
6
25
  export declare function getCallsStatus<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, params: GetCallsStatusParams): Promise<GetCallsStatusResult>;
7
26
  //# sourceMappingURL=getCallsStatus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCallsStatus.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/getCallsStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,KAAK,EACV,oBAAoB,IAAI,8BAA8B,EACtD,sBAAsB,IAAI,8BAA8B,EACzD,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAElE,wBAAsB,cAAc,CAClC,QAAQ,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,CAAC,OAAO,CAAC,GACvB,SAAS,EAEb,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EACtC,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"getCallsStatus.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/getCallsStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,KAAK,EACV,oBAAoB,IAAI,8BAA8B,EACtD,sBAAsB,IAAI,8BAA8B,EACzD,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAElE;;;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