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

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 (125) 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.js +1 -1
  11. package/dist/esm/capabilities/permissions/mav2.js.map +1 -1
  12. package/dist/esm/client/actions/requestAccount.d.ts +2 -2
  13. package/dist/esm/client/actions/requestAccount.js +2 -2
  14. package/dist/esm/client/actions/requestAccount.js.map +1 -1
  15. package/dist/esm/client/actions/signMessage.d.ts +1 -1
  16. package/dist/esm/client/actions/signMessage.js +1 -1
  17. package/dist/esm/client/actions/signMessage.js.map +1 -1
  18. package/dist/esm/client/actions/signSignatureRequest.d.ts +1 -1
  19. package/dist/esm/client/actions/signSignatureRequest.js +2 -2
  20. package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
  21. package/dist/esm/client/actions/signTypedData.d.ts +1 -1
  22. package/dist/esm/client/actions/signTypedData.js +1 -1
  23. package/dist/esm/client/actions/signTypedData.js.map +1 -1
  24. package/dist/esm/client/client.e2e-test.js +2 -2
  25. package/dist/esm/client/client.e2e-test.js.map +1 -1
  26. package/dist/esm/client/decorator.d.ts +7 -7
  27. package/dist/esm/client/decorator.js +10 -10
  28. package/dist/esm/client/decorator.js.map +1 -1
  29. package/dist/esm/client/index.d.ts +1 -1
  30. package/dist/esm/client/index.js +3 -3
  31. package/dist/esm/client/index.js.map +1 -1
  32. package/dist/esm/exports/index.d.ts +13 -13
  33. package/dist/esm/exports/index.js +13 -13
  34. package/dist/esm/exports/index.js.map +1 -1
  35. package/dist/esm/exports/internal.d.ts +12 -12
  36. package/dist/esm/exports/internal.js +11 -11
  37. package/dist/esm/exports/internal.js.map +1 -1
  38. package/dist/esm/isomorphic/actions/createSession.d.ts +3 -3
  39. package/dist/esm/isomorphic/actions/createSession.js +5 -5
  40. package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
  41. package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +2 -2
  42. package/dist/esm/isomorphic/actions/getCallsStatus.js +3 -3
  43. package/dist/esm/isomorphic/actions/getCallsStatus.js.map +1 -1
  44. package/dist/esm/isomorphic/actions/prepareCalls.d.ts +2 -2
  45. package/dist/esm/isomorphic/actions/prepareCalls.js +2 -2
  46. package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
  47. package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +2 -2
  48. package/dist/esm/isomorphic/actions/sendPreparedCalls.js +2 -2
  49. package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
  50. package/dist/esm/isomorphic/client.d.ts +6 -6
  51. package/dist/esm/isomorphic/client.js +4 -4
  52. package/dist/esm/isomorphic/client.js.map +1 -1
  53. package/dist/esm/isomorphic/utils/createAccount.d.ts +2 -2
  54. package/dist/esm/isomorphic/utils/createAccount.js +1 -1
  55. package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
  56. package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +4 -4
  57. package/dist/esm/isomorphic/utils/parsePermissionsContext.js +1 -1
  58. package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +1 -1
  59. package/dist/esm/local/client.js +4 -4
  60. package/dist/esm/local/client.js.map +1 -1
  61. package/dist/esm/remote/client.js +3 -3
  62. package/dist/esm/remote/client.js.map +1 -1
  63. package/dist/esm/rpc/request.js +3 -3
  64. package/dist/esm/rpc/request.js.map +1 -1
  65. package/dist/esm/rpc/schema.js +1 -1
  66. package/dist/esm/rpc/schema.js.map +1 -1
  67. package/dist/types/abi/index.d.ts +8 -8
  68. package/dist/types/abi/index.d.ts.map +1 -1
  69. package/dist/types/client/actions/requestAccount.d.ts +2 -2
  70. package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
  71. package/dist/types/client/actions/signMessage.d.ts +1 -1
  72. package/dist/types/client/actions/signMessage.d.ts.map +1 -1
  73. package/dist/types/client/actions/signSignatureRequest.d.ts +1 -1
  74. package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
  75. package/dist/types/client/actions/signTypedData.d.ts +1 -1
  76. package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
  77. package/dist/types/client/decorator.d.ts +7 -7
  78. package/dist/types/client/decorator.d.ts.map +1 -1
  79. package/dist/types/client/index.d.ts +1 -1
  80. package/dist/types/client/index.d.ts.map +1 -1
  81. package/dist/types/exports/index.d.ts +13 -13
  82. package/dist/types/exports/index.d.ts.map +1 -1
  83. package/dist/types/exports/internal.d.ts +12 -12
  84. package/dist/types/exports/internal.d.ts.map +1 -1
  85. package/dist/types/isomorphic/actions/createSession.d.ts +3 -3
  86. package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
  87. package/dist/types/isomorphic/actions/getCallsStatus.d.ts +2 -2
  88. package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +1 -1
  89. package/dist/types/isomorphic/actions/prepareCalls.d.ts +2 -2
  90. package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
  91. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +2 -2
  92. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
  93. package/dist/types/isomorphic/client.d.ts +6 -6
  94. package/dist/types/isomorphic/client.d.ts.map +1 -1
  95. package/dist/types/isomorphic/utils/createAccount.d.ts +2 -2
  96. package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -1
  97. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +4 -4
  98. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +1 -1
  99. package/dist/types/remote/client.d.ts.map +1 -1
  100. package/package.json +8 -3
  101. package/src/abi/index.ts +8 -8
  102. package/src/capabilities/index.ts +3 -3
  103. package/src/capabilities/overrides.ts +1 -1
  104. package/src/capabilities/permissions/index.ts +1 -1
  105. package/src/capabilities/permissions/mav2.ts +1 -1
  106. package/src/client/actions/requestAccount.ts +4 -4
  107. package/src/client/actions/signMessage.ts +2 -2
  108. package/src/client/actions/signSignatureRequest.ts +2 -2
  109. package/src/client/actions/signTypedData.ts +2 -2
  110. package/src/client/client.e2e-test.ts +2 -2
  111. package/src/client/decorator.ts +18 -18
  112. package/src/client/index.ts +6 -3
  113. package/src/exports/index.ts +13 -13
  114. package/src/exports/internal.ts +12 -12
  115. package/src/isomorphic/actions/createSession.ts +15 -15
  116. package/src/isomorphic/actions/getCallsStatus.ts +6 -6
  117. package/src/isomorphic/actions/prepareCalls.ts +4 -4
  118. package/src/isomorphic/actions/sendPreparedCalls.ts +4 -4
  119. package/src/isomorphic/client.ts +8 -5
  120. package/src/isomorphic/utils/createAccount.ts +3 -3
  121. package/src/isomorphic/utils/parsePermissionsContext.ts +3 -3
  122. package/src/local/client.ts +4 -4
  123. package/src/remote/client.ts +3 -3
  124. package/src/rpc/request.ts +3 -3
  125. package/src/rpc/schema.ts +1 -1
@@ -1,18 +1,18 @@
1
1
  // TODO: anything that we want to expose publicly should be exported from `index.ts` files in the subdirectories
2
2
  // and we shouldn't export * for the sake of tree-shaking
3
- export { createSmartWalletClient, } from "../client";
4
- export { WalletServerRpcSchema, } from "../rpc/schema";
3
+ export { createSmartWalletClient, } from "../client/index.js";
4
+ export { WalletServerRpcSchema, } from "../rpc/schema.js";
5
5
  // capabilities: TODO: should these actually just have the types exported?
6
- export { Capabilities } from "../capabilities";
7
- export { PaymasterCapability } from "../capabilities/paymaster";
8
- export { PermissionsArray, PermissionsCapability, PermissionsContext, PermissionsData, } from "../capabilities/permissions";
6
+ export { Capabilities } from "../capabilities/index.js";
7
+ export { PaymasterCapability } from "../capabilities/paymaster.js";
8
+ export { PermissionsArray, PermissionsCapability, PermissionsContext, PermissionsData, } from "../capabilities/permissions/index.js";
9
9
  // client actions
10
- export { createAccount } from "../client/actions/createAccount";
11
- export { listAccounts } from "../client/actions/listAccounts";
12
- export { prepareCalls } from "../client/actions/prepareCalls";
13
- export { requestAccount } from "../client/actions/requestAccount";
14
- export { getCallsStatus } from "../client/actions/getCallsStatus";
15
- export { signSignatureRequest } from "../client/actions/signSignatureRequest";
16
- export { signMessage } from "../client/actions/signMessage";
17
- export { signTypedData } from "../client/actions/signTypedData";
10
+ export { createAccount } from "../client/actions/createAccount.js";
11
+ export { getCallsStatus } from "../client/actions/getCallsStatus.js";
12
+ export { listAccounts } from "../client/actions/listAccounts.js";
13
+ export { prepareCalls } from "../client/actions/prepareCalls.js";
14
+ export { requestAccount } from "../client/actions/requestAccount.js";
15
+ export { signMessage } from "../client/actions/signMessage.js";
16
+ export { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
17
+ export { signTypedData } from "../client/actions/signTypedData.js";
18
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,yDAAyD;AACzD,OAAO,EACL,uBAAuB,GAExB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,qBAAqB,GAGtB,MAAM,eAAe,CAAC;AAEvB,0EAA0E;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AAErC,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC","sourcesContent":["// TODO: anything that we want to expose publicly should be exported from `index.ts` files in the subdirectories\n// and we shouldn't export * for the sake of tree-shaking\nexport {\n createSmartWalletClient,\n type SmartWalletClientParams,\n} from \"../client\";\n\nexport {\n WalletServerRpcSchema,\n type WalletServerRpcSchemaType,\n type WalletServerViemRpcSchema,\n} from \"../rpc/schema\";\n\n// capabilities: TODO: should these actually just have the types exported?\nexport { Capabilities } from \"../capabilities\";\nexport { PaymasterCapability } from \"../capabilities/paymaster\";\nexport {\n PermissionsArray,\n PermissionsCapability,\n PermissionsContext,\n PermissionsData,\n} from \"../capabilities/permissions\";\n\n// client actions\nexport { createAccount } from \"../client/actions/createAccount\";\nexport { listAccounts } from \"../client/actions/listAccounts\";\nexport { prepareCalls } from \"../client/actions/prepareCalls\";\nexport { requestAccount } from \"../client/actions/requestAccount\";\nexport { getCallsStatus } from \"../client/actions/getCallsStatus\";\nexport { signSignatureRequest } from \"../client/actions/signSignatureRequest\";\nexport { signMessage } from \"../client/actions/signMessage\";\nexport { signTypedData } from \"../client/actions/signTypedData\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,yDAAyD;AACzD,OAAO,EACL,uBAAuB,GAExB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,GAGtB,MAAM,kBAAkB,CAAC;AAE1B,0EAA0E;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAChB,MAAM,sCAAsC,CAAC;AAE9C,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC","sourcesContent":["// TODO: anything that we want to expose publicly should be exported from `index.ts` files in the subdirectories\n// and we shouldn't export * for the sake of tree-shaking\nexport {\n createSmartWalletClient,\n type SmartWalletClientParams,\n} from \"../client/index.js\";\n\nexport {\n WalletServerRpcSchema,\n type WalletServerRpcSchemaType,\n type WalletServerViemRpcSchema,\n} from \"../rpc/schema.js\";\n\n// capabilities: TODO: should these actually just have the types exported?\nexport { Capabilities } from \"../capabilities/index.js\";\nexport { PaymasterCapability } from \"../capabilities/paymaster.js\";\nexport {\n PermissionsArray,\n PermissionsCapability,\n PermissionsContext,\n PermissionsData,\n} from \"../capabilities/permissions/index.js\";\n\n// client actions\nexport { createAccount } from \"../client/actions/createAccount.js\";\nexport { getCallsStatus } from \"../client/actions/getCallsStatus.js\";\nexport { listAccounts } from \"../client/actions/listAccounts.js\";\nexport { prepareCalls } from \"../client/actions/prepareCalls.js\";\nexport { requestAccount } from \"../client/actions/requestAccount.js\";\nexport { signMessage } from \"../client/actions/signMessage.js\";\nexport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nexport { signTypedData } from \"../client/actions/signTypedData.js\";\n"]}
@@ -1,13 +1,13 @@
1
- export * from "../capabilities";
2
- export * from "../capabilities/paymaster";
3
- export * from "../capabilities/permissions";
4
- export * from "../capabilities/permissions/mav2";
5
- export type * from "../isomorphic/client";
6
- export { createIsomorphicClient } from "../isomorphic/client";
7
- export { createDummySigner } from "../isomorphic/utils/createDummySigner";
8
- export * from "../rpc/request";
9
- export * as RpcSchemas from "../rpc/request";
10
- export * from "../rpc/schema";
11
- export * from "../schemas";
1
+ export * from "../capabilities/index.js";
2
+ export * from "../capabilities/paymaster.js";
3
+ export * from "../capabilities/permissions/index.js";
4
+ export * from "../capabilities/permissions/mav2.js";
5
+ export type * from "../isomorphic/client.js";
6
+ export { createIsomorphicClient } from "../isomorphic/client.js";
7
+ export { createDummySigner } from "../isomorphic/utils/createDummySigner.js";
8
+ export * from "../rpc/request.js";
9
+ export * as RpcSchemas from "../rpc/request.js";
10
+ export * from "../rpc/schema.js";
11
+ export * from "../schemas.js";
12
12
  export type * from "../types";
13
- export * from "../utils";
13
+ export * from "../utils.js";
@@ -1,15 +1,15 @@
1
1
  // exports from this file are meant to be imported by our packages in the monorepo
2
2
  // we will expose this in the package.json as a named export like `this-pkg/internal`
3
3
  // TODO: name `this-pkg`
4
- export * from "../capabilities";
5
- export * from "../capabilities/paymaster";
6
- export * from "../capabilities/permissions";
7
- export * from "../capabilities/permissions/mav2";
8
- export { createIsomorphicClient } from "../isomorphic/client";
9
- export { createDummySigner } from "../isomorphic/utils/createDummySigner";
10
- export * from "../rpc/request";
11
- export * as RpcSchemas from "../rpc/request";
12
- export * from "../rpc/schema";
13
- export * from "../schemas";
14
- export * from "../utils";
4
+ export * from "../capabilities/index.js";
5
+ export * from "../capabilities/paymaster.js";
6
+ export * from "../capabilities/permissions/index.js";
7
+ export * from "../capabilities/permissions/mav2.js";
8
+ export { createIsomorphicClient } from "../isomorphic/client.js";
9
+ export { createDummySigner } from "../isomorphic/utils/createDummySigner.js";
10
+ export * from "../rpc/request.js";
11
+ export * as RpcSchemas from "../rpc/request.js";
12
+ export * from "../rpc/schema.js";
13
+ export * from "../schemas.js";
14
+ export * from "../utils.js";
15
15
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/exports/internal.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,qFAAqF;AACrF,wBAAwB;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AAEjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,cAAc,gBAAgB,CAAC;AAC/B,OAAO,KAAK,UAAU,MAAM,gBAAgB,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAE3B,cAAc,UAAU,CAAC","sourcesContent":["// exports from this file are meant to be imported by our packages in the monorepo\n// we will expose this in the package.json as a named export like `this-pkg/internal`\n// TODO: name `this-pkg`\nexport * from \"../capabilities\";\nexport * from \"../capabilities/paymaster\";\nexport * from \"../capabilities/permissions\";\nexport * from \"../capabilities/permissions/mav2\";\nexport type * from \"../isomorphic/client\";\nexport { createIsomorphicClient } from \"../isomorphic/client\";\nexport { createDummySigner } from \"../isomorphic/utils/createDummySigner\";\nexport * from \"../rpc/request\";\nexport * as RpcSchemas from \"../rpc/request\";\nexport * from \"../rpc/schema\";\nexport * from \"../schemas\";\nexport type * from \"../types\";\nexport * from \"../utils\";\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/exports/internal.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,qFAAqF;AACrF,wBAAwB;AACxB,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AAEpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,cAAc,mBAAmB,CAAC;AAClC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAE9B,cAAc,aAAa,CAAC","sourcesContent":["// exports from this file are meant to be imported by our packages in the monorepo\n// we will expose this in the package.json as a named export like `this-pkg/internal`\n// TODO: name `this-pkg`\nexport * from \"../capabilities/index.js\";\nexport * from \"../capabilities/paymaster.js\";\nexport * from \"../capabilities/permissions/index.js\";\nexport * from \"../capabilities/permissions/mav2.js\";\nexport type * from \"../isomorphic/client.js\";\nexport { createIsomorphicClient } from \"../isomorphic/client.js\";\nexport { createDummySigner } from \"../isomorphic/utils/createDummySigner.js\";\nexport * from \"../rpc/request.js\";\nexport * as RpcSchemas from \"../rpc/request.js\";\nexport * from \"../rpc/schema.js\";\nexport * from \"../schemas.js\";\nexport type * from \"../types\";\nexport * from \"../utils.js\";\n"]}
@@ -1,8 +1,8 @@
1
1
  import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
2
- import { type Chain, type Transport, type Hex } from "viem";
3
- import type { wallet_createSession } from "../../rpc/request";
4
- import type { WalletServerViemRpcSchema } from "../../rpc/schema";
5
2
  import type { Static } from "@sinclair/typebox";
3
+ import { type Chain, type Hex, type Transport } from "viem";
4
+ import type { wallet_createSession } from "../../rpc/request.js";
5
+ import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
6
6
  export type CreateSessionParams = Omit<Static<(typeof wallet_createSession)["properties"]["Request"]["properties"]["params"]>[0], "chainId"> & {
7
7
  entityId?: Hex;
8
8
  };
@@ -1,11 +1,11 @@
1
1
  import { createSmartAccountClient, } from "@aa-sdk/core";
2
- import { ChainNotFoundError, custom, hexToNumber, toHex, } from "viem";
3
- import { isGlobalValidation } from "../../capabilities/permissions/mav2";
4
2
  import { deferralActions, PermissionBuilder, } from "@account-kit/smart-contracts/experimental";
5
- import { createDummySigner } from "../utils/createDummySigner";
6
- import { createAccount, isModularAccountV2 } from "../utils/createAccount";
7
3
  import { Value } from "@sinclair/typebox/value";
8
- import { TypePermission } from "../../capabilities/permissions";
4
+ import { ChainNotFoundError, custom, hexToNumber, toHex, } from "viem";
5
+ import { TypePermission } from "../../capabilities/permissions/index.js";
6
+ import { isGlobalValidation } from "../../capabilities/permissions/mav2.js";
7
+ import { createAccount, isModularAccountV2 } from "../utils/createAccount.js";
8
+ import { createDummySigner } from "../utils/createDummySigner.js";
9
9
  export async function createSession(client, params) {
10
10
  if (!client.chain) {
11
11
  throw new ChainNotFoundError();
@@ -1 +1 @@
1
- {"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAGzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAGlB,MAAM,EACN,WAAW,EAEX,KAAK,GACN,MAAM,MAAM,CAAC;AAId,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EACL,eAAe,EACf,iBAAiB,GAClB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAoBhE,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAMC,EACD,MAA2B;IAE3B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IAC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AC1B,MAAM,EAAE,OAAO;QACf,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,QAAQ;QACR,KAAK;QACL,QAAQ,EAAE,MAAM,CAAC,MAAM;KACxB,CAAC;SACC,cAAc,CAAC;QACd,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CACjD,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,CACzC;KACF,CAAC;SACD,eAAe,EAAE,CAAC;IAEvB,OAAO;QACL,SAAS,EAAE,IAAI,EAAE,kDAAkD;QACnE,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;QACzB,gBAAgB,EAAE;YAChB,IAAI,EAAE,sBAAsB;YAC5B,IAAI,EAAE,SAAS;SAChB;QACD,oCAAoC;KACrC,CAAC;AACJ,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport {\n ChainNotFoundError,\n type Chain,\n type Transport,\n custom,\n hexToNumber,\n type Hex,\n toHex,\n} from \"viem\";\nimport type { wallet_createSession } from \"../../rpc/request\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { isGlobalValidation } from \"../../capabilities/permissions/mav2\";\nimport {\n deferralActions,\n PermissionBuilder,\n} from \"@account-kit/smart-contracts/experimental\";\nimport { createDummySigner } from \"../utils/createDummySigner\";\nimport { createAccount, isModularAccountV2 } from \"../utils/createAccount\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport { TypePermission } from \"../../capabilities/permissions\";\n\nexport type CreateSessionParams = Omit<\n Static<\n (typeof wallet_createSession)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n> & {\n entityId?: Hex;\n};\n\nexport type CreateSessionResult = Omit<\n Static<(typeof wallet_createSession)[\"properties\"][\"ReturnType\"]>,\n \"sessionId\"\n> & {\n sessionId: Hex | null;\n entityId: Hex;\n fullPreSignatureDeferredActionDigest: Hex;\n};\n\nexport async function createSession(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: CreateSessionParams,\n): Promise<CreateSessionResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const { counterfactualInfo } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n {\n includeCounterfactualInfo: true,\n accountAddress: params.account,\n },\n ],\n });\n if (!counterfactualInfo) {\n throw new Error(\"No counterfactual info found.\");\n }\n\n const account = await createAccount({\n chain: client.chain,\n transport: custom(client.transport),\n signer: createDummySigner(params.account),\n accountAddress: params.account,\n counterfactualInfo,\n });\n\n if (!isModularAccountV2(account)) {\n throw new Error(\"Sessions are currently only supported by MAv2 accounts.\");\n }\n\n const _client = createSmartAccountClient({\n chain: client.chain,\n transport: custom(client.transport),\n account,\n }).extend(deferralActions);\n\n const { entityId, nonce } = await _client.getEntityIdAndNonce({\n entityId: params.entityId ? hexToNumber(params.entityId) : undefined,\n isGlobalValidation: isGlobalValidation(params),\n });\n\n const { typedData, fullPreSignatureDeferredActionDigest } =\n await new PermissionBuilder({\n client: _client,\n key: params.key,\n entityId,\n nonce,\n deadline: params.expiry,\n })\n .addPermissions({\n permissions: params.permissions.map((permission) =>\n Value.Encode(TypePermission, permission),\n ),\n })\n .compileDeferred();\n\n return {\n sessionId: null, // In remote mode, the server will set this later.\n entityId: toHex(entityId),\n signatureRequest: {\n type: \"eth_signTypedData_v4\",\n data: typedData,\n },\n fullPreSignatureDeferredActionDigest,\n };\n}\n"]}
1
+ {"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAGzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,eAAe,EACf,iBAAiB,GAClB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,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,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;QACnC,OAAO;KACR,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAE3B,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,MAAM,OAAO,CAAC,mBAAmB,CAAC;QAC5D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;QACpE,kBAAkB,EAAE,kBAAkB,CAAC,MAAM,CAAC;KAC/C,CAAC,CAAC;IAEH,MAAM,EAAE,SAAS,EAAE,oCAAoC,EAAE,GACvD,MAAM,IAAI,iBAAiB,CAAC;QAC1B,MAAM,EAAE,OAAO;QACf,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,QAAQ;QACR,KAAK;QACL,QAAQ,EAAE,MAAM,CAAC,MAAM;KACxB,CAAC;SACC,cAAc,CAAC;QACd,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CACjD,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,CACzC;KACF,CAAC;SACD,eAAe,EAAE,CAAC;IAEvB,OAAO;QACL,SAAS,EAAE,IAAI,EAAE,kDAAkD;QACnE,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;QACzB,gBAAgB,EAAE;YAChB,IAAI,EAAE,sBAAsB;YAC5B,IAAI,EAAE,SAAS;SAChB;QACD,oCAAoC;KACrC,CAAC;AACJ,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport {\n deferralActions,\n PermissionBuilder,\n} from \"@account-kit/smart-contracts/experimental\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n ChainNotFoundError,\n custom,\n hexToNumber,\n toHex,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { TypePermission } from \"../../capabilities/permissions/index.js\";\nimport { isGlobalValidation } from \"../../capabilities/permissions/mav2.js\";\nimport type { wallet_createSession } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { createAccount, isModularAccountV2 } from \"../utils/createAccount.js\";\nimport { createDummySigner } from \"../utils/createDummySigner.js\";\n\nexport type CreateSessionParams = Omit<\n Static<\n (typeof wallet_createSession)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n> & {\n entityId?: Hex;\n};\n\nexport type CreateSessionResult = Omit<\n Static<(typeof wallet_createSession)[\"properties\"][\"ReturnType\"]>,\n \"sessionId\"\n> & {\n sessionId: Hex | null;\n entityId: Hex;\n fullPreSignatureDeferredActionDigest: Hex;\n};\n\nexport async function createSession(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: CreateSessionParams,\n): Promise<CreateSessionResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const { counterfactualInfo } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n {\n includeCounterfactualInfo: true,\n accountAddress: params.account,\n },\n ],\n });\n if (!counterfactualInfo) {\n throw new Error(\"No counterfactual info found.\");\n }\n\n const account = await createAccount({\n chain: client.chain,\n transport: custom(client.transport),\n signer: createDummySigner(params.account),\n accountAddress: params.account,\n counterfactualInfo,\n });\n\n if (!isModularAccountV2(account)) {\n throw new Error(\"Sessions are currently only supported by MAv2 accounts.\");\n }\n\n const _client = createSmartAccountClient({\n chain: client.chain,\n transport: custom(client.transport),\n account,\n }).extend(deferralActions);\n\n const { entityId, nonce } = await _client.getEntityIdAndNonce({\n entityId: params.entityId ? hexToNumber(params.entityId) : undefined,\n isGlobalValidation: isGlobalValidation(params),\n });\n\n const { typedData, fullPreSignatureDeferredActionDigest } =\n await new PermissionBuilder({\n client: _client,\n key: params.key,\n entityId,\n nonce,\n deadline: params.expiry,\n })\n .addPermissions({\n permissions: params.permissions.map((permission) =>\n Value.Encode(TypePermission, permission),\n ),\n })\n .compileDeferred();\n\n return {\n sessionId: null, // In remote mode, the server will set this later.\n entityId: toHex(entityId),\n signatureRequest: {\n type: \"eth_signTypedData_v4\",\n data: typedData,\n },\n fullPreSignatureDeferredActionDigest,\n };\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
2
2
  import type { Static } from "@sinclair/typebox";
3
3
  import { type Chain, type Transport } from "viem";
4
- import type { wallet_getCallsStatus } from "../../rpc/request";
5
- import type { WalletServerViemRpcSchema } from "../../rpc/schema";
4
+ import type { wallet_getCallsStatus } from "../../rpc/request.js";
5
+ import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
6
6
  export type GetCallsStatusParams = Static<(typeof wallet_getCallsStatus)["properties"]["Request"]["properties"]["params"]>[0];
7
7
  export type GetCallsStatusResponse = Static<(typeof wallet_getCallsStatus)["properties"]["ReturnType"]>;
8
8
  /** EIP-5792 call status codes */
@@ -1,8 +1,8 @@
1
1
  import {} from "@aa-sdk/core";
2
- import { ChainNotFoundError, isHex, } from "viem";
3
- import { TypeCallId } from "../../schemas";
4
- import { castToHex } from "../../utils";
5
2
  import { Value } from "@sinclair/typebox/value";
3
+ import { ChainNotFoundError, isHex, } from "viem";
4
+ import { TypeCallId } from "../../schemas.js";
5
+ import { castToHex } from "../../utils.js";
6
6
  const ReceiptStatus = {
7
7
  reverted: "0x0",
8
8
  success: "0x1",
@@ -1 +1 @@
1
- {"version":3,"file":"getCallsStatus.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/getCallsStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,EAKlB,KAAK,GACN,MAAM,MAAM,CAAC;A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C5E,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CACvB,OAA2B;IAE3B,OAAO;QACL,wGAAwG;QACxG,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAC3B,CAAC,CAAC,OAAO,CAAC,MAAM;YAChB,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;QACjC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,+FAA+F;QAC/F,WAAW,EAAE,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC;QAC3C,2FAA2F;QAC3F,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;QACnC,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC/B,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,MAAM,EAAE,GAAG,CAAC,MAAM;SACnB,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC","sourcesContent":["import {\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport {\n ChainNotFoundError,\n type Chain,\n type Hex,\n type TransactionReceipt,\n type Transport,\n isHex,\n} from \"viem\";\nimport type { wallet_getCallsStatus } from \"../../rpc/request\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema\";\nimport { TypeCallId } from \"../../schemas\";\nimport { castToHex } from \"../../utils\";\nimport { Value } from \"@sinclair/typebox/value\";\n\nexport type GetCallsStatusParams = Static<\n (typeof wallet_getCallsStatus)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n>[0];\n\nexport type GetCallsStatusResponse = Static<\n (typeof wallet_getCallsStatus)[\"properties\"][\"ReturnType\"]\n>;\n\nconst ReceiptStatus: Record<TransactionReceipt[\"status\"], Hex> = {\n reverted: \"0x0\",\n success: \"0x1\",\n};\n\n/** EIP-5792 call status codes */\nexport const CallStatusCode = {\n /** Batch has been received by the wallet but has not completed execution onchain */\n PENDING: 100,\n /** Batch has been included onchain without reverts, receipts array contains info of all calls */\n CONFIRMED: 200,\n /** Batch has not been included onchain and wallet will not retry */\n OFFCHAIN_FAILURE: 400,\n /** Batch reverted *completely* and only changes related to gas charge may have been included onchain */\n CHAIN_RULES_FAILURE: 500,\n /** Batch reverted *partially* and some changes related to batch calls may have been included onchain */\n PARTIAL_CHAIN_RULES_FAILURE: 600,\n} as const;\n\nexport async function getCallsStatus(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n callId: GetCallsStatusParams,\n): Promise<GetCallsStatusResponse> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const { chainId, hash } = Value.Decode(TypeCallId, callId);\n\n const result = await client.getUserOperationReceipt(hash);\n\n return {\n id: callId,\n chainId,\n atomic: true,\n status: !result?.receipt\n ? CallStatusCode.PENDING\n : result.success\n ? CallStatusCode.CONFIRMED\n : CallStatusCode.CHAIN_RULES_FAILURE,\n receipts: !result?.receipt ? undefined : [transformReceipt(result.receipt)],\n };\n}\n\nfunction transformReceipt(\n receipt: TransactionReceipt,\n): NonNullable<GetCallsStatusResponse[\"receipts\"]>[number] {\n return {\n // viem's type for status is \"success\" | \"reverted\", but the actual value seems to already be 0x0 or 0x1\n status: isHex(receipt.status)\n ? receipt.status\n : ReceiptStatus[receipt.status],\n blockHash: receipt.blockHash,\n // viem's type for blockNumber is bigint, but the actual value seems to already be a hex string\n blockNumber: castToHex(receipt.blockNumber),\n // viem's type for gasUsed is bigint, but the actual value seems to already be a hex string\n gasUsed: castToHex(receipt.gasUsed),\n transactionHash: receipt.transactionHash,\n logs: receipt.logs.map((log) => ({\n address: log.address,\n data: log.data,\n topics: log.topics,\n })),\n };\n}\n"]}
1
+ {"version":3,"file":"getCallsStatus.js","sourceRoot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cAAc,CAAC,mBAAmB;QACxC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;KAC5E,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CACvB,OAA2B;IAE3B,OAAO;QACL,wGAAwG;QACxG,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAC3B,CAAC,CAAC,OAAO,CAAC,MAAM;YAChB,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;QACjC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,+FAA+F;QAC/F,WAAW,EAAE,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC;QAC3C,2FAA2F;QAC3F,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;QACnC,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC/B,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,MAAM,EAAE,GAAG,CAAC,MAAM;SACnB,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC","sourcesContent":["import {\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n ChainNotFoundError,\n isHex,\n type Chain,\n type Hex,\n type TransactionReceipt,\n type Transport,\n} from \"viem\";\nimport type { wallet_getCallsStatus } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { TypeCallId } from \"../../schemas.js\";\nimport { castToHex } from \"../../utils.js\";\n\nexport type GetCallsStatusParams = Static<\n (typeof wallet_getCallsStatus)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n>[0];\n\nexport type GetCallsStatusResponse = Static<\n (typeof wallet_getCallsStatus)[\"properties\"][\"ReturnType\"]\n>;\n\nconst ReceiptStatus: Record<TransactionReceipt[\"status\"], Hex> = {\n reverted: \"0x0\",\n success: \"0x1\",\n};\n\n/** EIP-5792 call status codes */\nexport const CallStatusCode = {\n /** Batch has been received by the wallet but has not completed execution onchain */\n PENDING: 100,\n /** Batch has been included onchain without reverts, receipts array contains info of all calls */\n CONFIRMED: 200,\n /** Batch has not been included onchain and wallet will not retry */\n OFFCHAIN_FAILURE: 400,\n /** Batch reverted *completely* and only changes related to gas charge may have been included onchain */\n CHAIN_RULES_FAILURE: 500,\n /** Batch reverted *partially* and some changes related to batch calls may have been included onchain */\n PARTIAL_CHAIN_RULES_FAILURE: 600,\n} as const;\n\nexport async function getCallsStatus(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n callId: GetCallsStatusParams,\n): Promise<GetCallsStatusResponse> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const { chainId, hash } = Value.Decode(TypeCallId, callId);\n\n const result = await client.getUserOperationReceipt(hash);\n\n return {\n id: callId,\n chainId,\n atomic: true,\n status: !result?.receipt\n ? CallStatusCode.PENDING\n : result.success\n ? CallStatusCode.CONFIRMED\n : CallStatusCode.CHAIN_RULES_FAILURE,\n receipts: !result?.receipt ? undefined : [transformReceipt(result.receipt)],\n };\n}\n\nfunction transformReceipt(\n receipt: TransactionReceipt,\n): NonNullable<GetCallsStatusResponse[\"receipts\"]>[number] {\n return {\n // viem's type for status is \"success\" | \"reverted\", but the actual value seems to already be 0x0 or 0x1\n status: isHex(receipt.status)\n ? receipt.status\n : ReceiptStatus[receipt.status],\n blockHash: receipt.blockHash,\n // viem's type for blockNumber is bigint, but the actual value seems to already be a hex string\n blockNumber: castToHex(receipt.blockNumber),\n // viem's type for gasUsed is bigint, but the actual value seems to already be a hex string\n gasUsed: castToHex(receipt.gasUsed),\n transactionHash: receipt.transactionHash,\n logs: receipt.logs.map((log) => ({\n address: log.address,\n data: log.data,\n topics: log.topics,\n })),\n };\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
2
2
  import type { Static } from "@sinclair/typebox";
3
3
  import { type Chain, type Transport } from "viem";
4
- import type { wallet_prepareCalls } from "../../rpc/request";
5
- import type { WalletServerViemRpcSchema } from "../../rpc/schema";
4
+ import type { wallet_prepareCalls } from "../../rpc/request.js";
5
+ import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
6
6
  export type PrepareCallsParams = Omit<Static<(typeof wallet_prepareCalls)["properties"]["Request"]["properties"]["params"]>[0], "chainId">;
7
7
  export type PrepareCallsResult = Static<(typeof wallet_prepareCalls)["properties"]["ReturnType"]>;
8
8
  export declare function prepareCalls(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: PrepareCallsParams): Promise<PrepareCallsResult>;
@@ -1,7 +1,7 @@
1
1
  import { deepHexlify, } from "@aa-sdk/core";
2
2
  import { ChainNotFoundError, custom, fromHex, toHex, zeroAddress, } from "viem";
3
- import { createAccount } from "../utils/createAccount";
4
- import { createDummySigner } from "../utils/createDummySigner";
3
+ import { createAccount } from "../utils/createAccount.js";
4
+ import { createDummySigner } from "../utils/createDummySigner.js";
5
5
  // TODO: handle capabilities like permissions and paymaster here
6
6
  export async function prepareCalls(client, params) {
7
7
  if (!client.chain) {
@@ -1 +1 @@
1
- {"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAGZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,OAAO,EACP,KAAK,EACL,WAAW,GAGZ,MAAM,MAAM,CAAC;AAGd,OAA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Q,CAAC,CAAC,CAAC,CAAC,SAAS;SACxD,CAAC,CAAC;QACH,OAAO;QACP,SAAS,EAAE,MAAM,CAAC,YAAY,EAAE,iBAAiB;KAClD,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAEvC,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAErE,OAAO;QACL,IAAI,EACF,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO,KAAK,OAAO;YACzC,CAAC,CAAC,qBAAqB;YACvB,CAAC,CAAC,qBAAqB;QAC3B,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,gBAAgB,EAAE;YAChB,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE;gBACJ,GAAG,EAAE,IAAI;aACV;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import {\n deepHexlify,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport {\n ChainNotFoundError,\n custom,\n fromHex,\n toHex,\n zeroAddress,\n type Chain,\n type Transport,\n} from \"viem\";\nimport type { wallet_prepareCalls } from \"../../rpc/request\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema\";\nimport { createAccount } from \"../utils/createAccount\";\nimport { createDummySigner } from \"../utils/createDummySigner\";\n\nexport type PrepareCallsParams = Omit<\n Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n>;\n\nexport type PrepareCallsResult = Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"ReturnType\"]\n>;\n\n// TODO: handle capabilities like permissions and paymaster here\nexport async function prepareCalls(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: PrepareCallsParams,\n): Promise<PrepareCallsResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n // in local mode, we probably want some kind of caching for this\n const { counterfactualInfo } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n {\n accountAddress: params.from,\n includeCounterfactualInfo: true,\n },\n ],\n });\n if (!counterfactualInfo) {\n throw new Error(\"No counterfactual info found.\");\n }\n\n const account = await createAccount({\n chain: client.chain,\n transport: custom(client.transport),\n signer: createDummySigner(zeroAddress),\n accountAddress: params.from,\n counterfactualInfo,\n capabilities: params.capabilities,\n });\n\n // TODO: oops we don't actually support setting the policyId as an override here\n // if we assume that the the isomorphic client is never used directly, then we can assume that this is handled upstream correctly\n const builtUo = await client.buildUserOperation({\n uo: params.calls.map((x) => ({\n target: x.to,\n data: x.data ?? \"0x\",\n value: x.value ? fromHex(x.value, \"bigint\") : undefined,\n })),\n account,\n overrides: params.capabilities?.gasParamsOverride,\n });\n\n const uoRequest = deepHexlify(builtUo);\n\n const hash = account.getEntryPoint().getUserOperationHash(uoRequest);\n\n return {\n type:\n account.getEntryPoint().version === \"0.7.0\"\n ? \"user-operation-v070\"\n : \"user-operation-v060\",\n data: uoRequest,\n chainId: toHex(client.chain.id),\n signatureRequest: {\n type: \"personal_sign\",\n data: {\n raw: hash,\n },\n },\n };\n}\n"]}
1
+ {"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAGZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,OAAO,EACP,KAAK,EACL,WAAW,GAGZ,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAalE,gEAAgE;AAChE,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAMC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AW,CAAC,OAAO,CAAC,CAAC;IAEvC,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAErE,OAAO;QACL,IAAI,EACF,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO,KAAK,OAAO;YACzC,CAAC,CAAC,qBAAqB;YACvB,CAAC,CAAC,qBAAqB;QAC3B,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,gBAAgB,EAAE;YAChB,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE;gBACJ,GAAG,EAAE,IAAI;aACV;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import {\n deepHexlify,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport {\n ChainNotFoundError,\n custom,\n fromHex,\n toHex,\n zeroAddress,\n type Chain,\n type Transport,\n} from \"viem\";\nimport type { wallet_prepareCalls } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { createAccount } from \"../utils/createAccount.js\";\nimport { createDummySigner } from \"../utils/createDummySigner.js\";\n\nexport type PrepareCallsParams = Omit<\n Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n>;\n\nexport type PrepareCallsResult = Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"ReturnType\"]\n>;\n\n// TODO: handle capabilities like permissions and paymaster here\nexport async function prepareCalls(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: PrepareCallsParams,\n): Promise<PrepareCallsResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n // in local mode, we probably want some kind of caching for this\n const { counterfactualInfo } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n {\n accountAddress: params.from,\n includeCounterfactualInfo: true,\n },\n ],\n });\n if (!counterfactualInfo) {\n throw new Error(\"No counterfactual info found.\");\n }\n\n const account = await createAccount({\n chain: client.chain,\n transport: custom(client.transport),\n signer: createDummySigner(zeroAddress),\n accountAddress: params.from,\n counterfactualInfo,\n capabilities: params.capabilities,\n });\n\n // TODO: oops we don't actually support setting the policyId as an override here\n // if we assume that the the isomorphic client is never used directly, then we can assume that this is handled upstream correctly\n const builtUo = await client.buildUserOperation({\n uo: params.calls.map((x) => ({\n target: x.to,\n data: x.data ?? \"0x\",\n value: x.value ? fromHex(x.value, \"bigint\") : undefined,\n })),\n account,\n overrides: params.capabilities?.gasParamsOverride,\n });\n\n const uoRequest = deepHexlify(builtUo);\n\n const hash = account.getEntryPoint().getUserOperationHash(uoRequest);\n\n return {\n type:\n account.getEntryPoint().version === \"0.7.0\"\n ? \"user-operation-v070\"\n : \"user-operation-v060\",\n data: uoRequest,\n chainId: toHex(client.chain.id),\n signatureRequest: {\n type: \"personal_sign\",\n data: {\n raw: hash,\n },\n },\n };\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
2
2
  import type { Static, StaticDecode } from "@sinclair/typebox";
3
3
  import { type Chain, type Transport } from "viem";
4
- import type { wallet_sendPreparedCalls } from "../../rpc/request";
5
- import type { WalletServerViemRpcSchema } from "../../rpc/schema";
4
+ import type { wallet_sendPreparedCalls } from "../../rpc/request.js";
5
+ import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
6
6
  export type SendPreparedCallsParams = Omit<StaticDecode<(typeof wallet_sendPreparedCalls)["properties"]["Request"]["properties"]["params"]>[0], "chainId">;
7
7
  export type SendPreparedCallsResult = Static<(typeof wallet_sendPreparedCalls)["properties"]["ReturnType"]>;
8
8
  export declare function sendPreparedCalls(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: SendPreparedCallsParams): Promise<SendPreparedCallsResult>;
@@ -1,8 +1,8 @@
1
1
  import { getEntryPoint, } from "@aa-sdk/core";
2
2
  import { Value } from "@sinclair/typebox/value";
3
3
  import { ChainNotFoundError, concat, concatHex, toHex, } from "viem";
4
- import { decodePermissionsContext } from "../../capabilities/permissions/mav2";
5
- import { TypeCallId } from "../../schemas";
4
+ import { decodePermissionsContext } from "../../capabilities/permissions/mav2.js";
5
+ import { TypeCallId } from "../../schemas.js";
6
6
  // TODO: this only supports MAv2 right now, we need to fix this
7
7
  export async function sendPreparedCalls(client, params) {
8
8
  if (!client.chain) {
@@ -1 +1 @@
1
- {"version":3,"file":"sendPreparedCalls.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/sendPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GAGd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,KAAK,GAIN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAG/E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAa3C,+DAA+D;AAC/D,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAMC,EACD,MAA+B;IAE/B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,cAAc,GAAoB,CAAC,GAAG,EAAE;QAC5C,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;YAC/C,OAAO;QACT,CAAC;QAED,MAAM,cAAc,GAAG,wBAAwB,CAC7C,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CACxC,CAAC;QAEF,IAAI,cAAc,CAAC,cAAc,KAAK,6BAA6B,EAAE,CAAC;YACpE,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;QACJ,CAAC;QAED,OAAO,cAAc,CAAC,cAAc,CAAC;IACvC,CAAC,CAAC,EAAE,CAAC;IAEL,MAAM,UAAU,GACd,MAAM,CAAC,IAAI,KAAK,qBAAqB;QACnC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;QACnD,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAExD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAC5C;QACE,GAAG,MAAM,CAAC,IAAI;QACd,SAAS,EACP,cAAc,IAAI,IAAI;YACpB,CAAC,CAAC,SAAS,CAAC;gBACR,KAAK,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,gFAAgF;gBACjH,MAAM;gBACN,MAAM;gBACN,MAAM,CAAC,SAAS,CAAC,SAAS;aAC3B,CAAC;YACJ,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;KAC3D,EACD,UAAU,CAAC,OAAO,CACnB,CAAC;IAEF,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE;QACtC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,IAAI;KACL,CAAC,CAAC;IAEH,OAAO;QACL,eAAe,EAAE,CAAC,MAAM,CAAC;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["import {\n getEntryPoint,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static, StaticDecode } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n ChainNotFoundError,\n concat,\n concatHex,\n toHex,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { decodePermissionsContext } from \"../../capabilities/permissions/mav2\";\nimport type { wallet_sendPreparedCalls } from \"../../rpc/request\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema\";\nimport { TypeCallId } from \"../../schemas\";\n\nexport type SendPreparedCallsParams = Omit<\n StaticDecode<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n>;\n\nexport type SendPreparedCallsResult = Static<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"ReturnType\"]\n>;\n\n// TODO: this only supports MAv2 right now, we need to fix this\nexport async function sendPreparedCalls(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: SendPreparedCallsParams,\n): Promise<SendPreparedCallsResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const deferredAction: Hex | undefined = (() => {\n if (!params.capabilities?.permissions?.context) {\n return;\n }\n\n const decodedContext = decodePermissionsContext(\n params.capabilities.permissions.context,\n );\n\n if (decodedContext.contextVersion === \"REMOTE_MODE_DEFERRED_ACTION\") {\n throw new Error(\n \"Remote mode deferred action not supported in isomorphic client\",\n );\n }\n\n return decodedContext.deferredAction;\n })();\n\n const entryPoint =\n params.type === \"user-operation-v060\"\n ? getEntryPoint(client.chain, { version: \"0.6.0\" })\n : getEntryPoint(client.chain, { version: \"0.7.0\" });\n\n const hash = await client.sendRawUserOperation(\n {\n ...params.data,\n signature:\n deferredAction != null\n ? concatHex([\n `0x${deferredAction.slice(68)}`, // Cuts off stuff preprended to the digest (nonce, etc. that we had previously).\n \"0xff\",\n \"0x00\",\n params.signature.signature,\n ])\n : concat([\"0xFF\", \"0x00\", params.signature.signature]),\n },\n entryPoint.address,\n );\n\n const callId = Value.Encode(TypeCallId, {\n chainId: toHex(client.chain.id),\n hash,\n });\n\n return {\n preparedCallIds: [callId],\n };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,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAC5C;QACE,GAAG,MAAM,CAAC,IAAI;QACd,SAAS,EACP,cAAc,IAAI,IAAI;YACpB,CAAC,CAAC,SAAS,CAAC;gBACR,KAAK,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,gFAAgF;gBACjH,MAAM;gBACN,MAAM;gBACN,MAAM,CAAC,SAAS,CAAC,SAAS;aAC3B,CAAC;YACJ,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;KAC3D,EACD,UAAU,CAAC,OAAO,CACnB,CAAC;IAEF,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE;QACtC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,IAAI;KACL,CAAC,CAAC;IAEH,OAAO;QACL,eAAe,EAAE,CAAC,MAAM,CAAC;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["import {\n getEntryPoint,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static, StaticDecode } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n ChainNotFoundError,\n concat,\n concatHex,\n toHex,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { decodePermissionsContext } from \"../../capabilities/permissions/mav2.js\";\nimport type { wallet_sendPreparedCalls } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { TypeCallId } from \"../../schemas.js\";\n\nexport type SendPreparedCallsParams = Omit<\n StaticDecode<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n>;\n\nexport type SendPreparedCallsResult = Static<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"ReturnType\"]\n>;\n\n// TODO: this only supports MAv2 right now, we need to fix this\nexport async function sendPreparedCalls(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: SendPreparedCallsParams,\n): Promise<SendPreparedCallsResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const deferredAction: Hex | undefined = (() => {\n if (!params.capabilities?.permissions?.context) {\n return;\n }\n\n const decodedContext = decodePermissionsContext(\n params.capabilities.permissions.context,\n );\n\n if (decodedContext.contextVersion === \"REMOTE_MODE_DEFERRED_ACTION\") {\n throw new Error(\n \"Remote mode deferred action not supported in isomorphic client\",\n );\n }\n\n return decodedContext.deferredAction;\n })();\n\n const entryPoint =\n params.type === \"user-operation-v060\"\n ? getEntryPoint(client.chain, { version: \"0.6.0\" })\n : getEntryPoint(client.chain, { version: \"0.7.0\" });\n\n const hash = await client.sendRawUserOperation(\n {\n ...params.data,\n signature:\n deferredAction != null\n ? concatHex([\n `0x${deferredAction.slice(68)}`, // Cuts off stuff preprended to the digest (nonce, etc. that we had previously).\n \"0xff\",\n \"0x00\",\n params.signature.signature,\n ])\n : concat([\"0xFF\", \"0x00\", params.signature.signature]),\n },\n entryPoint.address,\n );\n\n const callId = Value.Encode(TypeCallId, {\n chainId: toHex(client.chain.id),\n hash,\n });\n\n return {\n preparedCallIds: [callId],\n };\n}\n"]}
@@ -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,wBAAw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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,mBAAmB,EACnB,uCAAuC,EACvC,2BAA2B,GAE5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA8B,MAAM,MAAM,CAAC;AAElD,OAAO,EACL,aAAa,GAEd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,GAEf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,YAAY,GAEb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,GAElB,MAAM,gCAAgC,CAAC;AAUxC,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.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,10 +1,10 @@
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 { createIsomorphicClient, } from "../isomorphic/client.js";
7
+ import { assertNever } from "../utils.js";
8
8
  const localMethods = [
9
9
  "wallet_prepareCalls",
10
10
  "wallet_sendPreparedCalls",
@@ -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,CAAC,QAAQ,IAAI,SAAS,CAAC,EAAE,gBAAgB;KAC1C,CAAC;IAEF,MAAM,cAAc,GAAG,KAAK,CAAC;QAC3B,SAAS,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C;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;AAEjF,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;IACvD,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;QAC9C,SAAS;QACT,KAAK;QACL,QAAQ;QACR,oBAAoB,EAAE,KAAK;KAC5B,CAAC,CAAC;IAEH,MAAM,SAAS,GAA8D;QAC3E,CAAC,QA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CACE,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.js\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport type { PrepareCallsParams } from \"../isomorphic/actions/prepareCalls\";\nimport {\n createIsomorphicClient,\n type IsomorphicClient,\n} from \"../isomorphic/client.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n} from \"../types\";\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 // 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,8 +1,8 @@
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 { WalletServerRpcSchema } from "../rpc/schema.js";
6
6
  /**
7
7
  * This is a low-level client just used to make RPC requests in remote mode
8
8
  * This should be wrapped by a higher-level smart account client that provides actions
@@ -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,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,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 { encodePermissionsContext } from \"../capabilities/permissions/mav2.js\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport { WalletServerRpcSchema } from \"../rpc/schema.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n InnerWalletApiClientBase,\n} from \"../types\";\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"]}