@account-kit/wallet-client 0.1.0-alpha.0 → 0.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/abi/index.d.ts +8 -8
- package/dist/esm/abi/index.js +8 -8
- package/dist/esm/abi/index.js.map +1 -1
- package/dist/esm/capabilities/index.js +3 -3
- package/dist/esm/capabilities/index.js.map +1 -1
- package/dist/esm/capabilities/overrides.js +1 -1
- package/dist/esm/capabilities/overrides.js.map +1 -1
- package/dist/esm/capabilities/permissions/index.js +1 -1
- package/dist/esm/capabilities/permissions/index.js.map +1 -1
- package/dist/esm/capabilities/permissions/mav2.d.ts +2 -2
- package/dist/esm/capabilities/permissions/mav2.js +1 -1
- package/dist/esm/capabilities/permissions/mav2.js.map +1 -1
- package/dist/esm/client/actions/createAccount.d.ts +27 -2
- package/dist/esm/client/actions/createAccount.js +25 -0
- package/dist/esm/client/actions/createAccount.js.map +1 -1
- package/dist/esm/client/actions/getCallsStatus.d.ts +21 -2
- package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/client/actions/grantPermissions.d.ts +60 -2
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/listAccounts.d.ts +26 -2
- package/dist/esm/client/actions/listAccounts.js +24 -0
- package/dist/esm/client/actions/listAccounts.js.map +1 -1
- package/dist/esm/client/actions/prepareCalls.d.ts +28 -2
- package/dist/esm/client/actions/prepareCalls.js.map +1 -1
- package/dist/esm/client/actions/requestAccount.d.ts +23 -4
- package/dist/esm/client/actions/requestAccount.js +16 -5
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/sendPreparedCalls.d.ts +39 -2
- package/dist/esm/client/actions/sendPreparedCalls.js +37 -0
- package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signMessage.d.ts +23 -3
- package/dist/esm/client/actions/signMessage.js +5 -3
- package/dist/esm/client/actions/signMessage.js.map +1 -1
- package/dist/esm/client/actions/signSignatureRequest.d.ts +32 -1
- package/dist/esm/client/actions/signSignatureRequest.js +2 -2
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/actions/signTypedData.d.ts +36 -3
- package/dist/esm/client/actions/signTypedData.js +4 -2
- package/dist/esm/client/actions/signTypedData.js.map +1 -1
- package/dist/esm/client/client.e2e-test.js +101 -13
- package/dist/esm/client/client.e2e-test.js.map +1 -1
- package/dist/esm/client/decorator.d.ts +14 -12
- package/dist/esm/client/decorator.js +10 -10
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/client/index.d.ts +5 -5
- package/dist/esm/client/index.js +32 -6
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/exports/index.d.ts +14 -13
- package/dist/esm/exports/index.js +14 -13
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/internal.d.ts +13 -13
- package/dist/esm/exports/internal.js +11 -11
- package/dist/esm/exports/internal.js.map +1 -1
- package/dist/esm/internal/decorator.d.ts +2 -0
- package/dist/esm/internal/decorator.js +10 -0
- package/dist/esm/internal/decorator.js.map +1 -0
- package/dist/esm/isomorphic/actions/createSession.d.ts +3 -3
- package/dist/esm/isomorphic/actions/createSession.js +5 -5
- package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
- package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +2 -2
- package/dist/esm/isomorphic/actions/getCallsStatus.js +3 -3
- package/dist/esm/isomorphic/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/isomorphic/actions/prepareCalls.d.ts +2 -2
- package/dist/esm/isomorphic/actions/prepareCalls.js +2 -2
- package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
- package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +2 -2
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js +2 -2
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/isomorphic/client.d.ts +6 -6
- package/dist/esm/isomorphic/client.js +4 -4
- package/dist/esm/isomorphic/client.js.map +1 -1
- package/dist/esm/isomorphic/utils/createAccount.d.ts +2 -2
- package/dist/esm/isomorphic/utils/createAccount.js +1 -1
- package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
- package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +4 -4
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js +1 -1
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +1 -1
- package/dist/esm/local/client.d.ts +1 -1
- package/dist/esm/local/client.js +12 -5
- package/dist/esm/local/client.js.map +1 -1
- package/dist/esm/remote/client.d.ts +1 -1
- package/dist/esm/remote/client.js +9 -4
- package/dist/esm/remote/client.js.map +1 -1
- package/dist/esm/rpc/request.js +3 -3
- package/dist/esm/rpc/request.js.map +1 -1
- package/dist/esm/rpc/schema.d.ts +1 -1
- package/dist/esm/rpc/schema.js +1 -1
- package/dist/esm/rpc/schema.js.map +1 -1
- package/dist/esm/types.d.ts +15 -4
- package/dist/esm/types.js.map +1 -1
- package/dist/types/abi/index.d.ts +8 -8
- package/dist/types/abi/index.d.ts.map +1 -1
- package/dist/types/capabilities/permissions/mav2.d.ts +2 -2
- package/dist/types/capabilities/permissions/mav2.d.ts.map +1 -1
- package/dist/types/client/actions/createAccount.d.ts +27 -2
- package/dist/types/client/actions/createAccount.d.ts.map +1 -1
- package/dist/types/client/actions/getCallsStatus.d.ts +21 -2
- package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +60 -2
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/listAccounts.d.ts +26 -2
- package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
- package/dist/types/client/actions/prepareCalls.d.ts +28 -2
- package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/client/actions/requestAccount.d.ts +23 -4
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts +39 -2
- package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signMessage.d.ts +23 -3
- package/dist/types/client/actions/signMessage.d.ts.map +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts +32 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/actions/signTypedData.d.ts +36 -3
- package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/client/decorator.d.ts +14 -12
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +5 -5
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +14 -13
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/internal.d.ts +13 -13
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/internal/decorator.d.ts +3 -0
- package/dist/types/internal/decorator.d.ts.map +1 -0
- package/dist/types/isomorphic/actions/createSession.d.ts +3 -3
- package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts +2 -2
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/prepareCalls.d.ts +2 -2
- package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +2 -2
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/client.d.ts +6 -6
- package/dist/types/isomorphic/client.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/createAccount.d.ts +2 -2
- package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +4 -4
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +1 -1
- package/dist/types/local/client.d.ts +1 -1
- package/dist/types/local/client.d.ts.map +1 -1
- package/dist/types/remote/client.d.ts +1 -1
- package/dist/types/remote/client.d.ts.map +1 -1
- package/dist/types/rpc/schema.d.ts +1 -1
- package/dist/types/types.d.ts +15 -4
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +14 -7
- package/src/abi/index.ts +8 -8
- package/src/capabilities/index.ts +3 -3
- package/src/capabilities/overrides.ts +1 -1
- package/src/capabilities/permissions/index.ts +1 -1
- package/src/capabilities/permissions/mav2.ts +3 -3
- package/src/client/actions/createAccount.ts +27 -2
- package/src/client/actions/getCallsStatus.ts +21 -2
- package/src/client/actions/grantPermissions.ts +60 -2
- package/src/client/actions/listAccounts.ts +26 -2
- package/src/client/actions/prepareCalls.ts +28 -2
- package/src/client/actions/requestAccount.ts +44 -9
- package/src/client/actions/sendPreparedCalls.ts +39 -2
- package/src/client/actions/signMessage.ts +26 -6
- package/src/client/actions/signSignatureRequest.ts +33 -2
- package/src/client/actions/signTypedData.ts +41 -5
- package/src/client/client.e2e-test.ts +122 -13
- package/src/client/decorator.ts +25 -27
- package/src/client/index.ts +47 -13
- package/src/exports/index.ts +14 -13
- package/src/exports/internal.ts +13 -13
- package/src/internal/decorator.ts +12 -0
- package/src/isomorphic/actions/createSession.ts +15 -15
- package/src/isomorphic/actions/getCallsStatus.ts +6 -6
- package/src/isomorphic/actions/prepareCalls.ts +4 -4
- package/src/isomorphic/actions/sendPreparedCalls.ts +4 -4
- package/src/isomorphic/client.ts +8 -5
- package/src/isomorphic/utils/createAccount.ts +3 -3
- package/src/isomorphic/utils/parsePermissionsContext.ts +3 -3
- package/src/local/client.ts +56 -46
- package/src/remote/client.ts +13 -8
- package/src/rpc/request.ts +3 -3
- package/src/rpc/schema.ts +1 -1
- package/src/types.ts +18 -4
package/dist/esm/abi/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { LightAccountFactoryAbi_V1_0_1 } from "./LightAccountFactoryAbi_V1_0_1";
|
|
2
|
-
export { LightAccountFactoryAbi_V1_0_2 } from "./LightAccountFactoryAbi_V1_0_2";
|
|
3
|
-
export { LightAccountFactoryAbi_V1_1_0 } from "./LightAccountFactoryAbi_V1_1_0";
|
|
4
|
-
export { LightAccountFactoryAbi_V2_0_0 } from "./LightAccountFactoryAbi_V2_0_0";
|
|
5
|
-
export { ModularAccountFactoryAbi_V2_0_0 } from "./ModularAccountFactoryAbi_V2_0_0";
|
|
6
|
-
export { MultiOwnerLightAccountFactoryAbi_V2_0_0 } from "./MultiOwnerLightAccountFactoryAbi_V2_0_0";
|
|
7
|
-
export { MultiOwnerModularAccountFactoryAbi_V1_0_0 } from "./MultiOwnerModularAccountFactoryAbi_V1_0_0";
|
|
8
|
-
export { MultisigModularAccountFactoryAbi_V1_0_0 } from "./MultisigModularAccountFactoryAbi_V1_0_0";
|
|
1
|
+
export { LightAccountFactoryAbi_V1_0_1 } from "./LightAccountFactoryAbi_V1_0_1.js";
|
|
2
|
+
export { LightAccountFactoryAbi_V1_0_2 } from "./LightAccountFactoryAbi_V1_0_2.js";
|
|
3
|
+
export { LightAccountFactoryAbi_V1_1_0 } from "./LightAccountFactoryAbi_V1_1_0.js";
|
|
4
|
+
export { LightAccountFactoryAbi_V2_0_0 } from "./LightAccountFactoryAbi_V2_0_0.js";
|
|
5
|
+
export { ModularAccountFactoryAbi_V2_0_0 } from "./ModularAccountFactoryAbi_V2_0_0.js";
|
|
6
|
+
export { MultiOwnerLightAccountFactoryAbi_V2_0_0 } from "./MultiOwnerLightAccountFactoryAbi_V2_0_0.js";
|
|
7
|
+
export { MultiOwnerModularAccountFactoryAbi_V1_0_0 } from "./MultiOwnerModularAccountFactoryAbi_V1_0_0.js";
|
|
8
|
+
export { MultisigModularAccountFactoryAbi_V1_0_0 } from "./MultisigModularAccountFactoryAbi_V1_0_0.js";
|
package/dist/esm/abi/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { LightAccountFactoryAbi_V1_0_1 } from "./LightAccountFactoryAbi_V1_0_1";
|
|
2
|
-
export { LightAccountFactoryAbi_V1_0_2 } from "./LightAccountFactoryAbi_V1_0_2";
|
|
3
|
-
export { LightAccountFactoryAbi_V1_1_0 } from "./LightAccountFactoryAbi_V1_1_0";
|
|
4
|
-
export { LightAccountFactoryAbi_V2_0_0 } from "./LightAccountFactoryAbi_V2_0_0";
|
|
5
|
-
export { ModularAccountFactoryAbi_V2_0_0 } from "./ModularAccountFactoryAbi_V2_0_0";
|
|
6
|
-
export { MultiOwnerLightAccountFactoryAbi_V2_0_0 } from "./MultiOwnerLightAccountFactoryAbi_V2_0_0";
|
|
7
|
-
export { MultiOwnerModularAccountFactoryAbi_V1_0_0 } from "./MultiOwnerModularAccountFactoryAbi_V1_0_0";
|
|
8
|
-
export { MultisigModularAccountFactoryAbi_V1_0_0 } from "./MultisigModularAccountFactoryAbi_V1_0_0";
|
|
1
|
+
export { LightAccountFactoryAbi_V1_0_1 } from "./LightAccountFactoryAbi_V1_0_1.js";
|
|
2
|
+
export { LightAccountFactoryAbi_V1_0_2 } from "./LightAccountFactoryAbi_V1_0_2.js";
|
|
3
|
+
export { LightAccountFactoryAbi_V1_1_0 } from "./LightAccountFactoryAbi_V1_1_0.js";
|
|
4
|
+
export { LightAccountFactoryAbi_V2_0_0 } from "./LightAccountFactoryAbi_V2_0_0.js";
|
|
5
|
+
export { ModularAccountFactoryAbi_V2_0_0 } from "./ModularAccountFactoryAbi_V2_0_0.js";
|
|
6
|
+
export { MultiOwnerLightAccountFactoryAbi_V2_0_0 } from "./MultiOwnerLightAccountFactoryAbi_V2_0_0.js";
|
|
7
|
+
export { MultiOwnerModularAccountFactoryAbi_V1_0_0 } from "./MultiOwnerModularAccountFactoryAbi_V1_0_0.js";
|
|
8
|
+
export { MultisigModularAccountFactoryAbi_V1_0_0 } from "./MultisigModularAccountFactoryAbi_V1_0_0.js";
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/abi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/abi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,uCAAuC,EAAE,MAAM,8CAA8C,CAAC;AACvG,OAAO,EAAE,yCAAyC,EAAE,MAAM,gDAAgD,CAAC;AAC3G,OAAO,EAAE,uCAAuC,EAAE,MAAM,8CAA8C,CAAC","sourcesContent":["export { LightAccountFactoryAbi_V1_0_1 } from \"./LightAccountFactoryAbi_V1_0_1.js\";\nexport { LightAccountFactoryAbi_V1_0_2 } from \"./LightAccountFactoryAbi_V1_0_2.js\";\nexport { LightAccountFactoryAbi_V1_1_0 } from \"./LightAccountFactoryAbi_V1_1_0.js\";\nexport { LightAccountFactoryAbi_V2_0_0 } from \"./LightAccountFactoryAbi_V2_0_0.js\";\nexport { ModularAccountFactoryAbi_V2_0_0 } from \"./ModularAccountFactoryAbi_V2_0_0.js\";\nexport { MultiOwnerLightAccountFactoryAbi_V2_0_0 } from \"./MultiOwnerLightAccountFactoryAbi_V2_0_0.js\";\nexport { MultiOwnerModularAccountFactoryAbi_V1_0_0 } from \"./MultiOwnerModularAccountFactoryAbi_V1_0_0.js\";\nexport { MultisigModularAccountFactoryAbi_V1_0_0 } from \"./MultisigModularAccountFactoryAbi_V1_0_0.js\";\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Type } from "@sinclair/typebox";
|
|
2
|
-
import { GasParamsOverrideCapability } from "./overrides";
|
|
3
|
-
import { PaymasterCapability } from "./paymaster";
|
|
4
|
-
import { PermissionsCapability } from "./permissions";
|
|
2
|
+
import { GasParamsOverrideCapability } from "./overrides.js";
|
|
3
|
+
import { PaymasterCapability } from "./paymaster.js";
|
|
4
|
+
import { PermissionsCapability } from "./permissions/index.js";
|
|
5
5
|
export const Capabilities = Type.Object({
|
|
6
6
|
permissions: Type.Optional(PermissionsCapability),
|
|
7
7
|
paymasterService: Type.Optional(PaymasterCapability),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/capabilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/capabilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CACrC;IACE,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACjD,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IACpD,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC;CAC9D,EACD,EAAE,aAAa,EAAE,CAAC,EAAE,CACrB,CAAC","sourcesContent":["import { Type } from \"@sinclair/typebox\";\nimport { GasParamsOverrideCapability } from \"./overrides.js\";\nimport { PaymasterCapability } from \"./paymaster.js\";\nimport { PermissionsCapability } from \"./permissions/index.js\";\n\nexport const Capabilities = Type.Object(\n {\n permissions: Type.Optional(PermissionsCapability),\n paymasterService: Type.Optional(PaymasterCapability),\n gasParamsOverride: Type.Optional(GasParamsOverrideCapability),\n },\n { minProperties: 1 },\n);\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Type } from "@sinclair/typebox";
|
|
2
|
-
import { TypeHex } from "../schemas";
|
|
2
|
+
import { TypeHex } from "../schemas.js";
|
|
3
3
|
export const Mutliplier = Type.Object({ multiplier: Type.Number() });
|
|
4
4
|
// This is still being defined in https://github.com/ethereum/ERCs/pull/947/files#diff-dab085f963ca621595044bcbc0922705aa38b69f5bf8770dcb3d0496a633efcfR158
|
|
5
5
|
export const GasParamsOverrideCapability = Type.Object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../../src/capabilities/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../../src/capabilities/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAErE,2JAA2J;AAC3J,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC,MAAM,CACpD;IACE,kBAAkB,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;IACtE,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;IACxE,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;IAChE,6BAA6B,EAAE,IAAI,CAAC,QAAQ,CAC1C,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC,CACpC;IACD,uBAAuB,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;IAC3E,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;IAChE,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;CACzE,EACD,EAAE,aAAa,EAAE,CAAC,EAAE,CACrB,CAAC","sourcesContent":["import { Type } from \"@sinclair/typebox\";\nimport { TypeHex } from \"../schemas.js\";\n\nexport const Mutliplier = Type.Object({ multiplier: Type.Number() });\n\n// This is still being defined in https://github.com/ethereum/ERCs/pull/947/files#diff-dab085f963ca621595044bcbc0922705aa38b69f5bf8770dcb3d0496a633efcfR158\nexport const GasParamsOverrideCapability = Type.Object(\n {\n preVerificationGas: Type.Optional(Type.Union([TypeHex(), Mutliplier])),\n verificationGasLimit: Type.Optional(Type.Union([TypeHex(), Mutliplier])),\n callGasLimit: Type.Optional(Type.Union([TypeHex(), Mutliplier])),\n paymasterVerificationGasLimit: Type.Optional(\n Type.Union([TypeHex(), Mutliplier]),\n ),\n paymasterPostOpGasLimit: Type.Optional(Type.Union([TypeHex(), Mutliplier])),\n maxFeePerGas: Type.Optional(Type.Union([TypeHex(), Mutliplier])),\n maxPriorityFeePerGas: Type.Optional(Type.Union([TypeHex(), Mutliplier])),\n },\n { minProperties: 1 },\n);\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PermissionType } from "@account-kit/smart-contracts/experimental";
|
|
2
2
|
import { Type, } from "@sinclair/typebox";
|
|
3
|
-
import { KeySigner, TypeAddress, TypeHex } from "../../schemas";
|
|
3
|
+
import { KeySigner, TypeAddress, TypeHex } from "../../schemas.js";
|
|
4
4
|
const Permission = (typeString, // e.g., "root"
|
|
5
5
|
typeEnum, // e.g., PermissionType.ROOT
|
|
6
6
|
data, description) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/capabilities/permissions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EACL,IAAI,GAKL,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/capabilities/permissions/index.ts"],"names":[],"mappings":"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","sourcesContent":["import { PermissionType } from \"@account-kit/smart-contracts/experimental\";\nimport {\n Type,\n type TLiteral,\n type TLiteralValue,\n type TObject,\n type TSchema,\n} from \"@sinclair/typebox\";\nimport { KeySigner, TypeAddress, TypeHex } from \"../../schemas.js\";\n\nconst Permission = <\n TData extends TSchema,\n TLiteralVal extends TLiteralValue,\n TType extends TLiteral<TLiteralVal>,\n>(\n typeString: TLiteralVal, // e.g., \"root\"\n typeEnum: TLiteralVal, // e.g., PermissionType.ROOT\n data: TData,\n description: string,\n): TObject<{ type: TType; data: TData }> => {\n return Type.Transform(\n Type.Object(\n {\n type: Type.Literal(typeEnum),\n data,\n },\n { description },\n ),\n )\n .Decode((value) => ({\n ...value,\n type: typeString, // enum → string\n }))\n .Encode((value) => ({\n ...value,\n type: typeEnum, // string → enum\n })) as never;\n};\n\nconst NativeTokenTransfer = Permission(\n \"native-token-transfer\",\n PermissionType.NATIVE_TOKEN_TRANSFER,\n Type.Object({\n allowance: TypeHex(),\n }),\n \"allows transfer of native tokens from the account\",\n);\n\nconst Erc20TokenTransfer = Permission(\n \"erc20-token-transfer\",\n PermissionType.ERC20_TOKEN_TRANSFER,\n Type.Object({\n allowance: TypeHex(),\n address: TypeAddress,\n }),\n \"allows transfer or approval of erc20 tokens from the account\",\n);\n\nconst GasLimit = Permission(\n \"gas-limit\",\n PermissionType.GAS_LIMIT,\n Type.Object({\n limit: TypeHex(),\n }),\n \"allows the key to spend gas for UOs\",\n);\n\nconst ContractAccess = Permission(\n \"contract-access\",\n PermissionType.CONTRACT_ACCESS,\n Type.Object({\n address: TypeAddress,\n }),\n \"grants access to all functions in a contract\",\n);\n\nconst AccountFunction = Permission(\n \"account-functions\",\n PermissionType.ACCOUNT_FUNCTIONS,\n Type.Object({\n functions: Type.Array(TypeHex(), { minItems: 1 }),\n }),\n \"grants access to functions in the account\",\n);\n\nconst AllExternalFunctionAccess = Permission(\n \"functions-on-all-contracts\",\n PermissionType.FUNCTIONS_ON_ALL_CONTRACTS,\n Type.Object({\n functions: Type.Array(TypeHex(), { minItems: 1 }),\n }),\n \"access to a function selector in any address or contract\",\n);\n\nconst ContractFunctionAccess = Permission(\n \"functions-on-contract\",\n PermissionType.FUNCTIONS_ON_CONTRACT,\n Type.Object({\n address: TypeAddress,\n functions: Type.Array(TypeHex(), { minItems: 1 }),\n }),\n \"grants access to specified functions on a specific contract\",\n);\n\nconst Root = Permission(\n \"root\",\n PermissionType.ROOT,\n Type.Optional(Type.Never()),\n \"grants full access to everything\",\n);\n\nexport const TypePermission = Type.Union([\n // 7715 permissions\n NativeTokenTransfer,\n Erc20TokenTransfer,\n GasLimit,\n // additional permissions\n ContractAccess,\n AccountFunction,\n AllExternalFunctionAccess,\n ContractFunctionAccess,\n Root,\n]);\n\nexport const PermissionsArray = Type.Array(TypePermission, { minItems: 1 });\n\nexport const PermissionsContext = Type.Object({\n context: TypeHex(),\n});\n\nexport const PermissionsData = Type.Object({\n chainId: TypeHex(),\n expiry: Type.Optional(Type.Number()),\n key: KeySigner,\n permissions: PermissionsArray,\n});\n\nexport const PermissionsCapability = Type.Union([\n PermissionsContext,\n // TODO: support permissions object here instead of only context-encoded permissions\n // PermissionsData,\n]);\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Static } from "@sinclair/typebox";
|
|
2
2
|
import { type Hex } from "viem";
|
|
3
|
-
import type { PermissionsData } from ".";
|
|
4
|
-
import type { KeySigner } from "../../schemas";
|
|
3
|
+
import type { PermissionsData } from "./index.ts";
|
|
4
|
+
import type { KeySigner } from "../../schemas.ts";
|
|
5
5
|
export declare const SESSION_ID_LENGTH_BYTES = 16;
|
|
6
6
|
export declare const ENTITY_ID_LENGTH_BYTES = 4;
|
|
7
7
|
export declare const PermissionsContextVersion: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PermissionType } from "@account-kit/smart-contracts/experimental";
|
|
2
2
|
import { concatHex, sliceHex } from "viem";
|
|
3
|
-
import { assertNever } from "../../utils";
|
|
3
|
+
import { assertNever } from "../../utils.js";
|
|
4
4
|
export const SESSION_ID_LENGTH_BYTES = 16;
|
|
5
5
|
export const ENTITY_ID_LENGTH_BYTES = 4;
|
|
6
6
|
export const PermissionsContextVersion = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mav2.js","sourceRoot":"","sources":["../../../../src/capabilities/permissions/mav2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAY,MAAM,MAAM,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"mav2.js","sourceRoot":"","sources":["../../../../src/capabilities/permissions/mav2.ts"],"names":[],"mappings":"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","sourcesContent":["import { PermissionType } from \"@account-kit/smart-contracts/experimental\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { concatHex, sliceHex, type Hex } from \"viem\";\nimport type { PermissionsData } from \"./index.ts\";\nimport type { KeySigner } from \"../../schemas.ts\";\nimport { assertNever } from \"../../utils.js\";\n\nexport const SESSION_ID_LENGTH_BYTES = 16;\nexport const ENTITY_ID_LENGTH_BYTES = 4;\n\nexport const PermissionsContextVersion = {\n REMOTE_MODE_DEFERRED_ACTION: \"0x00\",\n LOCAL_MODE_DEFERRED_ACTION: \"0x01\",\n NON_DEFERRED_ACTION: \"0x02\",\n} as const;\n\ntype ContextVersionHex =\n (typeof PermissionsContextVersion)[keyof typeof PermissionsContextVersion];\n\ntype DecodedPermissionsContext = {\n contextVersion: keyof typeof PermissionsContextVersion;\n} & (\n | {\n contextVersion: \"REMOTE_MODE_DEFERRED_ACTION\";\n sessionId: Hex;\n signature: Hex;\n deferredAction?: never;\n }\n | {\n contextVersion: \"LOCAL_MODE_DEFERRED_ACTION\";\n deferredAction: Hex;\n sessionId?: never;\n signature?: never;\n }\n | {\n contextVersion: \"NON_DEFERRED_ACTION\";\n deferredAction?: never;\n sessionId?: never;\n signature?: never;\n entityId: Hex;\n isGlobalValidation: boolean;\n }\n);\n\nexport const encodePermissionsContext = (\n context: DecodedPermissionsContext,\n): Hex => {\n switch (context.contextVersion) {\n case \"REMOTE_MODE_DEFERRED_ACTION\":\n return concatHex([\n PermissionsContextVersion.REMOTE_MODE_DEFERRED_ACTION,\n context.sessionId,\n context.signature,\n ]);\n case \"LOCAL_MODE_DEFERRED_ACTION\":\n return concatHex([\n PermissionsContextVersion.LOCAL_MODE_DEFERRED_ACTION,\n context.deferredAction,\n ]);\n case \"NON_DEFERRED_ACTION\":\n return concatHex([\n PermissionsContextVersion.NON_DEFERRED_ACTION,\n context.isGlobalValidation ? \"0x01\" : \"0x00\",\n context.entityId,\n ]);\n default:\n return assertNever(context, \"Unexpected context version\");\n }\n};\n\nexport const decodePermissionsContext = (\n input: Hex,\n): DecodedPermissionsContext => {\n const contextVersion = sliceHex(input, 0, 1) as ContextVersionHex;\n switch (contextVersion) {\n case \"0x00\": {\n const sessionId = sliceHex(input, 1, SESSION_ID_LENGTH_BYTES + 1);\n const signature = sliceHex(input, SESSION_ID_LENGTH_BYTES + 1);\n return {\n contextVersion: \"REMOTE_MODE_DEFERRED_ACTION\",\n sessionId,\n signature,\n };\n }\n case \"0x01\": {\n const deferredAction = sliceHex(input, 1);\n return {\n contextVersion: \"LOCAL_MODE_DEFERRED_ACTION\",\n deferredAction,\n };\n }\n case \"0x02\": {\n const isGlobalValidation = sliceHex(input, 1, 2) === \"0x01\";\n const entityId = sliceHex(input, 2, ENTITY_ID_LENGTH_BYTES + 2);\n return {\n contextVersion: \"NON_DEFERRED_ACTION\",\n isGlobalValidation,\n entityId,\n };\n }\n default:\n return assertNever(\n contextVersion,\n `Unexpected context version: ${contextVersion}`,\n );\n }\n};\n\nexport const prefixSignatureKeyType = (\n sig: Hex,\n type: KeySigner[\"type\"],\n): Hex => {\n switch (type) {\n case \"secp256k1\":\n return concatHex([\"0x00\", sig]);\n case \"contract\":\n return concatHex([\"0x01\", sig]);\n default:\n return assertNever(type, \"Unexpected session key type\");\n }\n};\n\nexport const isGlobalValidation = (\n data: Pick<Static<typeof PermissionsData>, \"permissions\">,\n): boolean => {\n return data.permissions.some((p) => p.type === PermissionType.ROOT);\n};\n"]}
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import type { Static } from "@sinclair/typebox";
|
|
3
3
|
import type { Address } from "abitype";
|
|
4
|
-
import type { wallet_createAccount } from "../../rpc/request";
|
|
5
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
4
|
+
import type { wallet_createAccount } from "../../rpc/request.ts";
|
|
5
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
6
6
|
export type CreateAccountParams = Omit<Extract<Static<typeof wallet_createAccount>["Request"]["params"][0], {
|
|
7
7
|
signerAddress: Address;
|
|
8
8
|
}>, "signerAddress">;
|
|
9
9
|
export type CreateAccountResult = Static<typeof wallet_createAccount>["ReturnType"];
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new account for the provided signer using the wallet API client.
|
|
12
|
+
* This method is primarily used to import existing accounts.
|
|
13
|
+
* For most cases, you should use requestAccount instead.
|
|
14
|
+
* If the account already exists, an error will be thrown.
|
|
15
|
+
*
|
|
16
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
17
|
+
* @param {SmartAccountSigner} signer - The signer that will be associated with the account
|
|
18
|
+
* @param {CreateAccountParams} params - Parameters for creating the account
|
|
19
|
+
* @param {string} [params.id] - Optional UUID v4 identifier for the account
|
|
20
|
+
* @param {object} params.creationOptions - Options for account creation
|
|
21
|
+
* @param {string} [params.creationOptions.accountType] - Currently only "sma-b" (Modular Account v2) is supported
|
|
22
|
+
* @param {string} [params.creationOptions.salt] - Optional hex string to use as salt for account creation
|
|
23
|
+
* @returns {Promise<CreateAccountResult>} A Promise that resolves to the created account information
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Create a new account with a custom salt
|
|
27
|
+
* const account = await client.createAccount({
|
|
28
|
+
* creationOptions: {
|
|
29
|
+
* accountType: "sma-b",
|
|
30
|
+
* salt: "0x04"
|
|
31
|
+
* }
|
|
32
|
+
* });
|
|
33
|
+
* console.log(`Created account at address: ${account.accountAddress}`);
|
|
34
|
+
*/
|
|
10
35
|
export declare function createAccount(client: InnerWalletApiClient, signer: SmartAccountSigner, params: CreateAccountParams): Promise<CreateAccountResult>;
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new account for the provided signer using the wallet API client.
|
|
3
|
+
* This method is primarily used to import existing accounts.
|
|
4
|
+
* For most cases, you should use requestAccount instead.
|
|
5
|
+
* If the account already exists, an error will be thrown.
|
|
6
|
+
*
|
|
7
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
8
|
+
* @param {SmartAccountSigner} signer - The signer that will be associated with the account
|
|
9
|
+
* @param {CreateAccountParams} params - Parameters for creating the account
|
|
10
|
+
* @param {string} [params.id] - Optional UUID v4 identifier for the account
|
|
11
|
+
* @param {object} params.creationOptions - Options for account creation
|
|
12
|
+
* @param {string} [params.creationOptions.accountType] - Currently only "sma-b" (Modular Account v2) is supported
|
|
13
|
+
* @param {string} [params.creationOptions.salt] - Optional hex string to use as salt for account creation
|
|
14
|
+
* @returns {Promise<CreateAccountResult>} A Promise that resolves to the created account information
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Create a new account with a custom salt
|
|
18
|
+
* const account = await client.createAccount({
|
|
19
|
+
* creationOptions: {
|
|
20
|
+
* accountType: "sma-b",
|
|
21
|
+
* salt: "0x04"
|
|
22
|
+
* }
|
|
23
|
+
* });
|
|
24
|
+
* console.log(`Created account at address: ${account.accountAddress}`);
|
|
25
|
+
*/
|
|
1
26
|
export async function createAccount(client, signer, params) {
|
|
2
27
|
return client.request({
|
|
3
28
|
method: "wallet_createAccount",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../../../src/client/actions/createAccount.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA4B,EAC5B,MAA0B,EAC1B,MAA2B;IAE3B,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,MAAM,EAAE,sBAAsB;QAC9B,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC,UAAU,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC;KAClE,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport type { Address } from \"abitype\";\nimport type { wallet_createAccount } from \"../../rpc/request\";\nimport type { InnerWalletApiClient } from \"../../types\";\n\nexport type CreateAccountParams = Omit<\n Extract<\n Static<typeof wallet_createAccount>[\"Request\"][\"params\"][0],\n { signerAddress: Address }\n >,\n \"signerAddress\"\n>;\n\nexport type CreateAccountResult = Static<\n typeof wallet_createAccount\n>[\"ReturnType\"];\n\nexport async function createAccount(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: CreateAccountParams,\n): Promise<CreateAccountResult> {\n return client.request({\n method: \"wallet_createAccount\",\n params: [{ signerAddress: await signer.getAddress(), ...params }],\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../../../src/client/actions/createAccount.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA4B,EAC5B,MAA0B,EAC1B,MAA2B;IAE3B,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,MAAM,EAAE,sBAAsB;QAC9B,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC,UAAU,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC;KAClE,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport type { Address } from \"abitype\";\nimport type { wallet_createAccount } from \"../../rpc/request.ts\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\n\nexport type CreateAccountParams = Omit<\n Extract<\n Static<typeof wallet_createAccount>[\"Request\"][\"params\"][0],\n { signerAddress: Address }\n >,\n \"signerAddress\"\n>;\n\nexport type CreateAccountResult = Static<\n typeof wallet_createAccount\n>[\"ReturnType\"];\n\n/**\n * Creates a new account for the provided signer using the wallet API client.\n * This method is primarily used to import existing accounts.\n * For most cases, you should use requestAccount instead.\n * If the account already exists, an error will be thrown.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer that will be associated with the account\n * @param {CreateAccountParams} params - Parameters for creating the account\n * @param {string} [params.id] - Optional UUID v4 identifier for the account\n * @param {object} params.creationOptions - Options for account creation\n * @param {string} [params.creationOptions.accountType] - Currently only \"sma-b\" (Modular Account v2) is supported\n * @param {string} [params.creationOptions.salt] - Optional hex string to use as salt for account creation\n * @returns {Promise<CreateAccountResult>} A Promise that resolves to the created account information\n *\n * @example\n * // Create a new account with a custom salt\n * const account = await client.createAccount({\n * creationOptions: {\n * accountType: \"sma-b\",\n * salt: \"0x04\"\n * }\n * });\n * console.log(`Created account at address: ${account.accountAddress}`);\n */\nexport async function createAccount(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: CreateAccountParams,\n): Promise<CreateAccountResult> {\n return client.request({\n method: \"wallet_createAccount\",\n params: [{ signerAddress: await signer.getAddress(), ...params }],\n });\n}\n"]}
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
import type { Address, JsonRpcAccount } from "viem";
|
|
2
|
-
import type { GetCallsStatusParams as IsomorphicGetCallsStatusParams, GetCallsStatusResponse as IsomorphicGetCallsStatusResult } from "../../isomorphic/actions/getCallsStatus";
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
2
|
+
import type { GetCallsStatusParams as IsomorphicGetCallsStatusParams, GetCallsStatusResponse as IsomorphicGetCallsStatusResult } from "../../isomorphic/actions/getCallsStatus.ts";
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
4
|
export type GetCallsStatusParams = IsomorphicGetCallsStatusParams;
|
|
5
5
|
export type GetCallsStatusResult = IsomorphicGetCallsStatusResult;
|
|
6
|
+
/**
|
|
7
|
+
* Gets the status of a prepared call by its ID.
|
|
8
|
+
* This method is used to check the execution status of calls sent via sendPreparedCalls.
|
|
9
|
+
*
|
|
10
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
11
|
+
* @param {GetCallsStatusParams} params - The ID of the prepared call to check
|
|
12
|
+
* @returns {Promise<GetCallsStatusResult>} A Promise that resolves to the status information including:
|
|
13
|
+
* - id: The hex ID of the call
|
|
14
|
+
* - chainId: The chain ID in hex format
|
|
15
|
+
* - status: The current status of the batch execution
|
|
16
|
+
* - receipts: Optional array of transaction receipts if the batch has been executed
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // After sending prepared calls
|
|
20
|
+
* const sendResult = await client.sendPreparedCalls({...});
|
|
21
|
+
*
|
|
22
|
+
* // Check the status of the first call ID
|
|
23
|
+
* const status = await client.getCallsStatus(sendResult.preparedCallIds[0]);
|
|
24
|
+
*/
|
|
6
25
|
export declare function getCallsStatus<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, params: GetCallsStatusParams): Promise<GetCallsStatusResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCallsStatus.js","sourceRoot":"","sources":["../../../../src/client/actions/getCallsStatus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getCallsStatus.js","sourceRoot":"","sources":["../../../../src/client/actions/getCallsStatus.ts"],"names":[],"mappings":"AAuCA,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAA4B,EAC5B,MAA4B;IAE5B,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC;QAC1B,MAAM,EAAE,uBAAuB;QAC/B,MAAM,EAAE,CAAC,MAAM,CAAC;KACjB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Address, JsonRpcAccount } from \"viem\";\nimport type {\n GetCallsStatusParams as IsomorphicGetCallsStatusParams,\n GetCallsStatusResponse as IsomorphicGetCallsStatusResult,\n} from \"../../isomorphic/actions/getCallsStatus.ts\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\n\nexport type GetCallsStatusParams = IsomorphicGetCallsStatusParams;\n\nexport type GetCallsStatusResult = IsomorphicGetCallsStatusResult;\n\n/**\n * Gets the status of a prepared call by its ID.\n * This method is used to check the execution status of calls sent via sendPreparedCalls.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {GetCallsStatusParams} params - The ID of the prepared call to check\n * @returns {Promise<GetCallsStatusResult>} A Promise that resolves to the status information including:\n * - id: The hex ID of the call\n * - chainId: The chain ID in hex format\n * - status: The current status of the batch execution\n * - receipts: Optional array of transaction receipts if the batch has been executed\n *\n * @example\n * // After sending prepared calls\n * const sendResult = await client.sendPreparedCalls({...});\n *\n * // Check the status of the first call ID\n * const status = await client.getCallsStatus(sendResult.preparedCallIds[0]);\n */\nexport async function getCallsStatus<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n params: GetCallsStatusParams,\n): Promise<GetCallsStatusResult>;\n\nexport async function getCallsStatus(\n client: InnerWalletApiClient,\n params: GetCallsStatusParams,\n): Promise<GetCallsStatusResult> {\n return await client.request({\n method: \"wallet_getCallsStatus\",\n params: [params],\n });\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Address, type Hex, type IsUndefined, type JsonRpcAccount } from "viem";
|
|
2
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
2
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
3
3
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
4
|
-
import type { CreateSessionParams } from "../../isomorphic/actions/createSession";
|
|
4
|
+
import type { CreateSessionParams } from "../../isomorphic/actions/createSession.ts";
|
|
5
5
|
export type GrantPermissionsParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = Omit<CreateSessionParams, "account" | "chainId"> & (IsUndefined<TAccount> extends true ? {
|
|
6
6
|
account: Address;
|
|
7
7
|
} : {
|
|
@@ -10,4 +10,62 @@ export type GrantPermissionsParams<TAccount extends JsonRpcAccount<Address> | un
|
|
|
10
10
|
export type GrantPermissionsResult = {
|
|
11
11
|
context: Hex;
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Grants permissions to a smart account by creating a session.
|
|
15
|
+
* This allows another key to perform operations on behalf of the account.
|
|
16
|
+
*
|
|
17
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
18
|
+
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
19
|
+
* @param {GrantPermissionsParams} params - The parameters for granting permissions
|
|
20
|
+
* @param {Address} [params.account] - The account address (required if client was not initialized with an account)
|
|
21
|
+
* @param {number} params.expiry - Unix timestamp when the permissions expire
|
|
22
|
+
* @param {object} params.key - The session key information
|
|
23
|
+
* @param {string} params.key.publicKey - The public key of the session key
|
|
24
|
+
* @param {string} params.key.type - The type of the key (e.g., "secp256k1")
|
|
25
|
+
* @param {Array} params.permissions - Array of permission objects defining what the session key can do
|
|
26
|
+
* @returns {Promise<GrantPermissionsResult>} A Promise that resolves to the result containing a context identifier
|
|
27
|
+
* @returns {Hex} result.context - A hex identifier for the granted permissions context
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Create a session key and grant root permissions
|
|
31
|
+
* const sessionKey = LocalAccountSigner.generatePrivateKeySigner();
|
|
32
|
+
* const account = await client.requestAccount();
|
|
33
|
+
*
|
|
34
|
+
* const permissions = await client.grantPermissions({
|
|
35
|
+
* account: account.address,
|
|
36
|
+
* expiry: Math.floor(Date.now() / 1000) + 60 * 60, // 1 hour from now
|
|
37
|
+
* key: {
|
|
38
|
+
* publicKey: await sessionKey.getAddress(),
|
|
39
|
+
* type: "secp256k1",
|
|
40
|
+
* },
|
|
41
|
+
* permissions: [{ type: "root" }],
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* // Use the permissions to prepare a call
|
|
45
|
+
* const preparedUO = await client.prepareCalls({
|
|
46
|
+
* calls: [{ to: zeroAddress, value: "0x0" }],
|
|
47
|
+
* from: account.address,
|
|
48
|
+
* capabilities: {
|
|
49
|
+
* paymasterService: {
|
|
50
|
+
* policyId: "your-paymaster-policy-id",
|
|
51
|
+
* },
|
|
52
|
+
* permissions,
|
|
53
|
+
* },
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* // Sign with the session key
|
|
57
|
+
* const signature = await signSignatureRequest(
|
|
58
|
+
* sessionKey,
|
|
59
|
+
* preparedUO.signatureRequest,
|
|
60
|
+
* );
|
|
61
|
+
*
|
|
62
|
+
* // Send the prepared call using the session key
|
|
63
|
+
* const result = await client.sendPreparedCalls({
|
|
64
|
+
* ...preparedUO,
|
|
65
|
+
* signature,
|
|
66
|
+
* capabilities: {
|
|
67
|
+
* permissions,
|
|
68
|
+
* },
|
|
69
|
+
* });
|
|
70
|
+
*/
|
|
13
71
|
export declare function grantPermissions<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner, params: GrantPermissionsParams<TAccount>): Promise<GrantPermissionsResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grantPermissions.js","sourceRoot":"","sources":["../../../../src/client/actions/grantPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,GACN,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"grantPermissions.js","sourceRoot":"","sources":["../../../../src/client/actions/grantPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,GACN,MAAM,MAAM,CAAC;AAsFd,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAA4B,EAC5B,MAA0B,EAC1B,MAA8B;IAE9B,IAAI,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;IAC1C,CAAC;IAED,OAAO,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE;QACrC,GAAG,MAAM;QACT,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;KAChC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n type Address,\n type Hex,\n type IsUndefined,\n type JsonRpcAccount,\n toHex,\n} from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { CreateSessionParams } from \"../../isomorphic/actions/createSession.ts\";\n\nexport type GrantPermissionsParams<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = Omit<CreateSessionParams, \"account\" | \"chainId\"> &\n (IsUndefined<TAccount> extends true\n ? { account: Address }\n : { account?: never });\n\nexport type GrantPermissionsResult = {\n context: Hex;\n};\n\n/**\n * Grants permissions to a smart account by creating a session.\n * This allows another key to perform operations on behalf of the account.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer of the smart account\n * @param {GrantPermissionsParams} params - The parameters for granting permissions\n * @param {Address} [params.account] - The account address (required if client was not initialized with an account)\n * @param {number} params.expiry - Unix timestamp when the permissions expire\n * @param {object} params.key - The session key information\n * @param {string} params.key.publicKey - The public key of the session key\n * @param {string} params.key.type - The type of the key (e.g., \"secp256k1\")\n * @param {Array} params.permissions - Array of permission objects defining what the session key can do\n * @returns {Promise<GrantPermissionsResult>} A Promise that resolves to the result containing a context identifier\n * @returns {Hex} result.context - A hex identifier for the granted permissions context\n *\n * @example\n * // Create a session key and grant root permissions\n * const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n * const account = await client.requestAccount();\n *\n * const permissions = await client.grantPermissions({\n * account: account.address,\n * expiry: Math.floor(Date.now() / 1000) + 60 * 60, // 1 hour from now\n * key: {\n * publicKey: await sessionKey.getAddress(),\n * type: \"secp256k1\",\n * },\n * permissions: [{ type: \"root\" }],\n * });\n *\n * // Use the permissions to prepare a call\n * const preparedUO = await client.prepareCalls({\n * calls: [{ to: zeroAddress, value: \"0x0\" }],\n * from: account.address,\n * capabilities: {\n * paymasterService: {\n * policyId: \"your-paymaster-policy-id\",\n * },\n * permissions,\n * },\n * });\n *\n * // Sign with the session key\n * const signature = await signSignatureRequest(\n * sessionKey,\n * preparedUO.signatureRequest,\n * );\n *\n * // Send the prepared call using the session key\n * const result = await client.sendPreparedCalls({\n * ...preparedUO,\n * signature,\n * capabilities: {\n * permissions,\n * },\n * });\n */\nexport async function grantPermissions<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n signer: SmartAccountSigner,\n params: GrantPermissionsParams<TAccount>,\n): Promise<GrantPermissionsResult>;\n\nexport async function grantPermissions(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: GrantPermissionsParams,\n): Promise<GrantPermissionsResult> {\n if (client.account && !params.account) {\n params.account = client.account.address;\n }\n\n return client.grantPermissions(signer, {\n ...params,\n chainId: toHex(client.chain.id),\n });\n}\n"]}
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import type { Static } from "@sinclair/typebox";
|
|
2
|
-
import type { wallet_listAccounts } from "../../rpc/request";
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
2
|
+
import type { wallet_listAccounts } from "../../rpc/request.ts";
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
4
|
export type ListAccountsParams = Static<typeof wallet_listAccounts>["Request"]["params"][0];
|
|
5
5
|
export type ListAccountsResult = Static<typeof wallet_listAccounts>["ReturnType"];
|
|
6
|
+
/**
|
|
7
|
+
* Lists all smart accounts for a given signer using the wallet API client.
|
|
8
|
+
*
|
|
9
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
10
|
+
* @param {ListAccountsParams} params - Parameters for listing accounts
|
|
11
|
+
* @param {string} params.signerAddress - The address of the signer to list accounts for
|
|
12
|
+
* @param {number} [params.limit] - Optional maximum number of accounts to return (default: 100, max: 100)
|
|
13
|
+
* @param {string} [params.after] - Optional pagination cursor for fetching subsequent pages
|
|
14
|
+
* @returns {Promise<ListAccountsResult>} A Promise that resolves to the list of accounts and pagination metadata
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Fetch the first page of accounts
|
|
18
|
+
* const firstPage = await client.listAccounts({
|
|
19
|
+
* signerAddress: "0x123...",
|
|
20
|
+
* limit: 10
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* // If an 'after' cursor exists, use it to fetch the next page
|
|
24
|
+
* const nextPage = await client.listAccounts({
|
|
25
|
+
* signerAddress: "0x123...",
|
|
26
|
+
* limit: 10,
|
|
27
|
+
* after: firstPage.meta.after
|
|
28
|
+
* });
|
|
29
|
+
*/
|
|
6
30
|
export declare function listAccounts(client: InnerWalletApiClient, params: ListAccountsParams): Promise<ListAccountsResult>;
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lists all smart accounts for a given signer using the wallet API client.
|
|
3
|
+
*
|
|
4
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
5
|
+
* @param {ListAccountsParams} params - Parameters for listing accounts
|
|
6
|
+
* @param {string} params.signerAddress - The address of the signer to list accounts for
|
|
7
|
+
* @param {number} [params.limit] - Optional maximum number of accounts to return (default: 100, max: 100)
|
|
8
|
+
* @param {string} [params.after] - Optional pagination cursor for fetching subsequent pages
|
|
9
|
+
* @returns {Promise<ListAccountsResult>} A Promise that resolves to the list of accounts and pagination metadata
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Fetch the first page of accounts
|
|
13
|
+
* const firstPage = await client.listAccounts({
|
|
14
|
+
* signerAddress: "0x123...",
|
|
15
|
+
* limit: 10
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* // If an 'after' cursor exists, use it to fetch the next page
|
|
19
|
+
* const nextPage = await client.listAccounts({
|
|
20
|
+
* signerAddress: "0x123...",
|
|
21
|
+
* limit: 10,
|
|
22
|
+
* after: firstPage.meta.after
|
|
23
|
+
* });
|
|
24
|
+
*/
|
|
1
25
|
export async function listAccounts(client, params) {
|
|
2
26
|
return client.request({ method: "wallet_listAccounts", params: [params] });
|
|
3
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listAccounts.js","sourceRoot":"","sources":["../../../../src/client/actions/listAccounts.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAA4B,EAC5B,MAA0B;IAE1B,OAAO,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import type { Static } from \"@sinclair/typebox\";\nimport type { wallet_listAccounts } from \"../../rpc/request\";\nimport type { InnerWalletApiClient } from \"../../types\";\n\nexport type ListAccountsParams = Static<\n typeof wallet_listAccounts\n>[\"Request\"][\"params\"][0];\n\nexport type ListAccountsResult = Static<\n typeof wallet_listAccounts\n>[\"ReturnType\"];\n\nexport async function listAccounts(\n client: InnerWalletApiClient,\n params: ListAccountsParams,\n): Promise<ListAccountsResult> {\n return client.request({ method: \"wallet_listAccounts\", params: [params] });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"listAccounts.js","sourceRoot":"","sources":["../../../../src/client/actions/listAccounts.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAA4B,EAC5B,MAA0B;IAE1B,OAAO,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import type { Static } from \"@sinclair/typebox\";\nimport type { wallet_listAccounts } from \"../../rpc/request.ts\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\n\nexport type ListAccountsParams = Static<\n typeof wallet_listAccounts\n>[\"Request\"][\"params\"][0];\n\nexport type ListAccountsResult = Static<\n typeof wallet_listAccounts\n>[\"ReturnType\"];\n\n/**\n * Lists all smart accounts for a given signer using the wallet API client.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {ListAccountsParams} params - Parameters for listing accounts\n * @param {string} params.signerAddress - The address of the signer to list accounts for\n * @param {number} [params.limit] - Optional maximum number of accounts to return (default: 100, max: 100)\n * @param {string} [params.after] - Optional pagination cursor for fetching subsequent pages\n * @returns {Promise<ListAccountsResult>} A Promise that resolves to the list of accounts and pagination metadata\n *\n * @example\n * // Fetch the first page of accounts\n * const firstPage = await client.listAccounts({\n * signerAddress: \"0x123...\",\n * limit: 10\n * });\n *\n * // If an 'after' cursor exists, use it to fetch the next page\n * const nextPage = await client.listAccounts({\n * signerAddress: \"0x123...\",\n * limit: 10,\n * after: firstPage.meta.after\n * });\n */\nexport async function listAccounts(\n client: InnerWalletApiClient,\n params: ListAccountsParams,\n): Promise<ListAccountsResult> {\n return client.request({ method: \"wallet_listAccounts\", params: [params] });\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Address, type IsUndefined, type JsonRpcAccount } from "viem";
|
|
2
|
-
import type { PrepareCallsParams as IsomorphicPrepareCallsParams, PrepareCallsResult as IsomorphicPrepareCallsResult } from "../../isomorphic/actions/prepareCalls";
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
2
|
+
import type { PrepareCallsParams as IsomorphicPrepareCallsParams, PrepareCallsResult as IsomorphicPrepareCallsResult } from "../../isomorphic/actions/prepareCalls.ts";
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
4
|
export type GetAccountParam<TAccount> = IsUndefined<TAccount> extends true ? {
|
|
5
5
|
account: Address;
|
|
6
6
|
} : {
|
|
@@ -12,4 +12,30 @@ export type PrepareCallsParams<TAccount extends JsonRpcAccount<Address> | undefi
|
|
|
12
12
|
from?: never;
|
|
13
13
|
});
|
|
14
14
|
export type PrepareCallsResult = IsomorphicPrepareCallsResult;
|
|
15
|
+
/**
|
|
16
|
+
* Prepares a set of contract calls for execution by building a user operation.
|
|
17
|
+
* Returns the built user operation and a signature request that needs to be signed
|
|
18
|
+
* before submitting to sendPreparedCalls.
|
|
19
|
+
*
|
|
20
|
+
* @param {InnerWalletApiClient<TAccount>} client - The wallet API client to use for the request
|
|
21
|
+
* @param {PrepareCallsParams<TAccount>} params - Parameters for preparing calls
|
|
22
|
+
* @param {Array<{to: Address, data?: Hex, value?: Hex}>} params.calls - Array of contract calls to execute
|
|
23
|
+
* @param {Address} [params.from] - The address to execute the calls from (required if the client wasn't initialized with an account)
|
|
24
|
+
* @param {object} [params.capabilities] - Optional capabilities to include with the request
|
|
25
|
+
* @returns {Promise<PrepareCallsResult>} A Promise that resolves to the prepared calls result containing
|
|
26
|
+
* the user operation data and signature request
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // Prepare a sponosored user operation call
|
|
30
|
+
* const result = await client.prepareCalls({
|
|
31
|
+
* calls: [{
|
|
32
|
+
* to: "0x1234...",
|
|
33
|
+
* data: "0xabcdef...",
|
|
34
|
+
* value: "0x0"
|
|
35
|
+
* }],
|
|
36
|
+
* capabilities: {
|
|
37
|
+
* paymasterService: { policyId: "your-policy-id" }
|
|
38
|
+
* }
|
|
39
|
+
* });
|
|
40
|
+
*/
|
|
15
41
|
export declare function prepareCalls<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, params: PrepareCallsParams<TAccount>): Promise<PrepareCallsResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAIN,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAIN,MAAM,MAAM,CAAC;AAwDd,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAA4B,EAC5B,MAA0B;IAE1B,IAAI,MAAM,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,gBAAgB,EAAE,CAAC;QAC9D,MAAM,CAAC,YAAY,GAAG;YACpB,GAAG,MAAM,CAAC,YAAY;YACtB,gBAAgB,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE;SAChD,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACnC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC;QAC1B,MAAM,EAAE,qBAAqB;QAC7B,MAAM,EAAE,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;KACzD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n toHex,\n type Address,\n type IsUndefined,\n type JsonRpcAccount,\n} from \"viem\";\nimport type {\n PrepareCallsParams as IsomorphicPrepareCallsParams,\n PrepareCallsResult as IsomorphicPrepareCallsResult,\n} from \"../../isomorphic/actions/prepareCalls.ts\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\n\nexport type GetAccountParam<TAccount> =\n IsUndefined<TAccount> extends true\n ? { account: Address }\n : { account?: never };\n\nexport type PrepareCallsParams<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = Omit<IsomorphicPrepareCallsParams, \"from\" | \"chainId\"> &\n (IsUndefined<TAccount> extends true ? { from: Address } : { from?: never });\n\nexport type PrepareCallsResult = IsomorphicPrepareCallsResult;\n\n/**\n * Prepares a set of contract calls for execution by building a user operation.\n * Returns the built user operation and a signature request that needs to be signed\n * before submitting to sendPreparedCalls.\n *\n * @param {InnerWalletApiClient<TAccount>} client - The wallet API client to use for the request\n * @param {PrepareCallsParams<TAccount>} params - Parameters for preparing calls\n * @param {Array<{to: Address, data?: Hex, value?: Hex}>} params.calls - Array of contract calls to execute\n * @param {Address} [params.from] - The address to execute the calls from (required if the client wasn't initialized with an account)\n * @param {object} [params.capabilities] - Optional capabilities to include with the request\n * @returns {Promise<PrepareCallsResult>} A Promise that resolves to the prepared calls result containing\n * the user operation data and signature request\n *\n * @example\n * // Prepare a sponosored user operation call\n * const result = await client.prepareCalls({\n * calls: [{\n * to: \"0x1234...\",\n * data: \"0xabcdef...\",\n * value: \"0x0\"\n * }],\n * capabilities: {\n * paymasterService: { policyId: \"your-policy-id\" }\n * }\n * });\n */\nexport async function prepareCalls<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n params: PrepareCallsParams<TAccount>,\n): Promise<PrepareCallsResult>;\n\nexport async function prepareCalls(\n client: InnerWalletApiClient,\n params: PrepareCallsParams,\n): Promise<PrepareCallsResult> {\n if (client.policyId && !params.capabilities?.paymasterService) {\n params.capabilities = {\n ...params.capabilities,\n paymasterService: { policyId: client.policyId },\n };\n }\n\n if (client.account && !params.from) {\n params.from = client.account.address;\n }\n\n return await client.request({\n method: \"wallet_prepareCalls\",\n params: [{ ...params, chainId: toHex(client.chain.id) }],\n });\n}\n"]}
|
|
@@ -1,11 +1,30 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SmartAccountSigner, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
2
|
import type { Static } from "@sinclair/typebox";
|
|
3
3
|
import type { Address } from "abitype";
|
|
4
4
|
import { type IsUndefined, type JsonRpcAccount } from "viem";
|
|
5
|
-
import type { wallet_requestAccount } from "../../rpc/request";
|
|
6
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
5
|
+
import type { wallet_requestAccount } from "../../rpc/request.js";
|
|
6
|
+
import type { InnerWalletApiClient } from "../../types.js";
|
|
7
7
|
export type RequestAccountParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = IsUndefined<TAccount> extends true ? Omit<Extract<Static<typeof wallet_requestAccount>["Request"]["params"][0], {
|
|
8
8
|
signerAddress: Address;
|
|
9
|
-
}>, "signerAddress" | "includeCounterfactualInfo">
|
|
9
|
+
}>, "signerAddress" | "includeCounterfactualInfo"> & {
|
|
10
|
+
accountAddress?: Address;
|
|
11
|
+
} : never;
|
|
10
12
|
export type RequestAccountResult = SmartContractAccount;
|
|
13
|
+
/**
|
|
14
|
+
* Requests an account for the provided signer using the wallet API client.
|
|
15
|
+
* If an account already exists for the signer, it will always return that account unless a new ID is specified.
|
|
16
|
+
* If an account already exists, the creationHint will be ignored.
|
|
17
|
+
*
|
|
18
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
19
|
+
* @param {SmartAccountSigner} signer - The signer that will be associated with the account
|
|
20
|
+
* @param {RequestAccountParams} [params] - Optional parameters for requesting a specific account
|
|
21
|
+
* @param {string} [params.id] - Optional identifier for the account. If specified, a new account with this ID will be created even if one already exists for the signer
|
|
22
|
+
* @param {object} [params.creationHint] - Optional hints to guide account creation. These are ignored if an account already exists
|
|
23
|
+
* @returns {Promise<RequestAccountResult>} A Promise that resolves to a SmartContractAccount instance
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Request an account with default parameters using a local signer
|
|
27
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner("0x...");
|
|
28
|
+
* const account = await client.requestAccount(signer);
|
|
29
|
+
*/
|
|
11
30
|
export declare function requestAccount<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner, params?: RequestAccountParams<TAccount>): Promise<RequestAccountResult>;
|