@account-kit/wallet-client 0.1.0-alpha.0 → 0.1.0-alpha.10
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/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/formatSign.d.ts +28 -0
- package/dist/esm/client/actions/formatSign.js +30 -0
- package/dist/esm/client/actions/formatSign.js.map +1 -0
- package/dist/esm/client/actions/getCallsStatus.d.ts +22 -4
- package/dist/esm/client/actions/getCallsStatus.js +19 -0
- package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/client/actions/grantPermissions.d.ts +63 -6
- package/dist/esm/client/actions/grantPermissions.js +63 -3
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/listAccounts.d.ts +32 -4
- package/dist/esm/client/actions/listAccounts.js +35 -2
- package/dist/esm/client/actions/listAccounts.js.map +1 -1
- package/dist/esm/client/actions/prepareCalls.d.ts +32 -6
- package/dist/esm/client/actions/prepareCalls.js +39 -5
- package/dist/esm/client/actions/prepareCalls.js.map +1 -1
- package/dist/esm/client/actions/prepareSign.d.ts +25 -0
- package/dist/esm/client/actions/prepareSign.js +28 -0
- package/dist/esm/client/actions/prepareSign.js.map +1 -0
- package/dist/esm/client/actions/requestAccount.d.ts +25 -7
- package/dist/esm/client/actions/requestAccount.js +39 -8
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/sendPreparedCalls.d.ts +33 -4
- package/dist/esm/client/actions/sendPreparedCalls.js +37 -1
- package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signMessage.d.ts +25 -5
- package/dist/esm/client/actions/signMessage.js +23 -3
- package/dist/esm/client/actions/signMessage.js.map +1 -1
- package/dist/esm/client/actions/signPreparedCalls.d.ts +14 -0
- package/dist/esm/client/actions/signPreparedCalls.js +43 -0
- package/dist/esm/client/actions/signPreparedCalls.js.map +1 -0
- package/dist/esm/client/actions/signSignatureRequest.d.ts +39 -5
- package/dist/esm/client/actions/signSignatureRequest.js +70 -12
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/actions/signTypedData.d.ts +37 -4
- package/dist/esm/client/actions/signTypedData.js +35 -2
- package/dist/esm/client/actions/signTypedData.js.map +1 -1
- package/dist/esm/client/client.e2e-test.js +211 -46
- package/dist/esm/client/client.e2e-test.js.map +1 -1
- package/dist/esm/client/decorator.d.ts +19 -15
- package/dist/esm/client/decorator.js +13 -11
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/client/index.d.ts +39 -13
- package/dist/esm/client/index.js +3 -6
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/exports/index.d.ts +12 -13
- package/dist/esm/exports/index.js +12 -14
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/internal.d.ts +4 -13
- package/dist/esm/exports/internal.js +2 -14
- 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 +2 -3
- package/dist/esm/isomorphic/actions/createSession.js +41 -12
- package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
- package/dist/esm/isomorphic/actions/formatSign.d.ts +8 -0
- package/dist/esm/isomorphic/actions/formatSign.js +42 -0
- package/dist/esm/isomorphic/actions/formatSign.js.map +1 -0
- package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +1 -15
- package/dist/esm/isomorphic/actions/getCallsStatus.js +39 -28
- package/dist/esm/isomorphic/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/isomorphic/actions/prepareCalls.d.ts +1 -2
- package/dist/esm/isomorphic/actions/prepareCalls.js +80 -22
- package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
- package/dist/esm/isomorphic/actions/prepareSign.d.ts +7 -0
- package/dist/esm/isomorphic/actions/prepareSign.js +49 -0
- package/dist/esm/isomorphic/actions/prepareSign.js.map +1 -0
- package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +3 -4
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js +138 -25
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/isomorphic/client.d.ts +209 -32
- package/dist/esm/isomorphic/client.js +10 -6
- package/dist/esm/isomorphic/client.js.map +1 -1
- package/dist/esm/isomorphic/utils/7702.d.ts +19 -0
- package/dist/esm/isomorphic/utils/7702.js +70 -0
- package/dist/esm/isomorphic/utils/7702.js.map +1 -0
- package/dist/esm/isomorphic/utils/createAccount.d.ts +5 -4
- package/dist/esm/isomorphic/utils/createAccount.js +85 -11
- package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
- package/dist/esm/isomorphic/utils/createDummySigner.js +3 -3
- package/dist/esm/isomorphic/utils/createDummySigner.js.map +1 -1
- package/dist/esm/isomorphic/utils/decodeSignature.d.ts +3 -0
- package/dist/esm/isomorphic/utils/decodeSignature.js +15 -0
- package/dist/esm/isomorphic/utils/decodeSignature.js.map +1 -0
- package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +6 -5
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js +19 -6
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +1 -1
- package/dist/esm/isomorphic/utils/supportsFeature.d.ts +4 -0
- package/dist/esm/isomorphic/utils/supportsFeature.js +21 -0
- package/dist/esm/isomorphic/utils/supportsFeature.js.map +1 -0
- package/dist/esm/local/client.d.ts +3 -3
- package/dist/esm/local/client.js +14 -7
- package/dist/esm/local/client.js.map +1 -1
- package/dist/esm/remote/client.d.ts +9 -3
- package/dist/esm/remote/client.js +11 -12
- package/dist/esm/remote/client.js.map +1 -1
- package/dist/esm/types.d.ts +27 -13
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils.d.ts +1 -0
- package/dist/esm/utils.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/client/actions/createAccount.d.ts +27 -2
- package/dist/types/client/actions/createAccount.d.ts.map +1 -1
- package/dist/types/client/actions/formatSign.d.ts +29 -0
- package/dist/types/client/actions/formatSign.d.ts.map +1 -0
- package/dist/types/client/actions/getCallsStatus.d.ts +22 -4
- package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +63 -6
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/listAccounts.d.ts +32 -4
- package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
- package/dist/types/client/actions/prepareCalls.d.ts +32 -6
- package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/client/actions/prepareSign.d.ts +26 -0
- package/dist/types/client/actions/prepareSign.d.ts.map +1 -0
- package/dist/types/client/actions/requestAccount.d.ts +25 -7
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts +33 -4
- package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signMessage.d.ts +25 -5
- package/dist/types/client/actions/signMessage.d.ts.map +1 -1
- package/dist/types/client/actions/signPreparedCalls.d.ts +15 -0
- package/dist/types/client/actions/signPreparedCalls.d.ts.map +1 -0
- package/dist/types/client/actions/signSignatureRequest.d.ts +39 -5
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/actions/signTypedData.d.ts +37 -4
- package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/client/decorator.d.ts +19 -15
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +39 -13
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +12 -13
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/internal.d.ts +4 -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 +2 -3
- package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/formatSign.d.ts +9 -0
- package/dist/types/isomorphic/actions/formatSign.d.ts.map +1 -0
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts +1 -15
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/prepareCalls.d.ts +1 -2
- package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/prepareSign.d.ts +8 -0
- package/dist/types/isomorphic/actions/prepareSign.d.ts.map +1 -0
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +3 -4
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/client.d.ts +209 -32
- package/dist/types/isomorphic/client.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/7702.d.ts +20 -0
- package/dist/types/isomorphic/utils/7702.d.ts.map +1 -0
- package/dist/types/isomorphic/utils/createAccount.d.ts +5 -4
- package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/createDummySigner.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/decodeSignature.d.ts +4 -0
- package/dist/types/isomorphic/utils/decodeSignature.d.ts.map +1 -0
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +6 -5
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/supportsFeature.d.ts +5 -0
- package/dist/types/isomorphic/utils/supportsFeature.d.ts.map +1 -0
- package/dist/types/local/client.d.ts +3 -3
- package/dist/types/local/client.d.ts.map +1 -1
- package/dist/types/remote/client.d.ts +9 -3
- package/dist/types/remote/client.d.ts.map +1 -1
- package/dist/types/types.d.ts +27 -13
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +1 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +15 -7
- package/src/abi/index.ts +8 -8
- package/src/client/actions/createAccount.ts +27 -2
- package/src/client/actions/formatSign.ts +53 -0
- package/src/client/actions/getCallsStatus.ts +21 -12
- package/src/client/actions/grantPermissions.ts +69 -26
- package/src/client/actions/listAccounts.ts +44 -6
- package/src/client/actions/prepareCalls.ts +46 -26
- package/src/client/actions/prepareSign.ts +46 -0
- package/src/client/actions/requestAccount.ts +62 -43
- package/src/client/actions/sendPreparedCalls.ts +44 -7
- package/src/client/actions/signMessage.ts +27 -22
- package/src/client/actions/signPreparedCalls.ts +67 -0
- package/src/client/actions/signSignatureRequest.ts +85 -21
- package/src/client/actions/signTypedData.ts +41 -20
- package/src/client/client.e2e-test.ts +257 -55
- package/src/client/decorator.ts +41 -39
- package/src/client/index.ts +55 -42
- package/src/exports/index.ts +13 -21
- package/src/exports/internal.ts +5 -13
- package/src/internal/decorator.ts +12 -0
- package/src/isomorphic/actions/createSession.ts +65 -22
- package/src/isomorphic/actions/formatSign.ts +76 -0
- package/src/isomorphic/actions/getCallsStatus.ts +49 -35
- package/src/isomorphic/actions/prepareCalls.ts +97 -25
- package/src/isomorphic/actions/prepareSign.ts +91 -0
- package/src/isomorphic/actions/sendPreparedCalls.ts +181 -42
- package/src/isomorphic/client.ts +17 -6
- package/src/isomorphic/utils/7702.ts +135 -0
- package/src/isomorphic/utils/createAccount.ts +102 -14
- package/src/isomorphic/utils/createDummySigner.ts +3 -2
- package/src/isomorphic/utils/decodeSignature.ts +21 -0
- package/src/isomorphic/utils/parsePermissionsContext.ts +29 -11
- package/src/isomorphic/utils/supportsFeature.ts +34 -0
- package/src/local/client.ts +61 -58
- package/src/remote/client.ts +20 -20
- package/src/types.ts +29 -23
- package/src/utils.ts +2 -0
- package/dist/esm/capabilities/index.d.ts +0 -31
- package/dist/esm/capabilities/index.js +0 -10
- package/dist/esm/capabilities/index.js.map +0 -1
- package/dist/esm/capabilities/overrides.d.ts +0 -26
- package/dist/esm/capabilities/overrides.js +0 -14
- package/dist/esm/capabilities/overrides.js.map +0 -1
- package/dist/esm/capabilities/paymaster.d.ts +0 -3
- package/dist/esm/capabilities/paymaster.js +0 -5
- package/dist/esm/capabilities/paymaster.js.map +0 -1
- package/dist/esm/capabilities/permissions/index.d.ts +0 -138
- package/dist/esm/capabilities/permissions/index.js +0 -71
- package/dist/esm/capabilities/permissions/index.js.map +0 -1
- package/dist/esm/capabilities/permissions/mav2.d.ts +0 -36
- package/dist/esm/capabilities/permissions/mav2.js +0 -79
- package/dist/esm/capabilities/permissions/mav2.js.map +0 -1
- package/dist/esm/rpc/request.d.ts +0 -352
- package/dist/esm/rpc/request.js +0 -204
- package/dist/esm/rpc/request.js.map +0 -1
- package/dist/esm/rpc/schema.d.ts +0 -342
- package/dist/esm/rpc/schema.js +0 -5
- package/dist/esm/rpc/schema.js.map +0 -1
- package/dist/esm/schemas.d.ts +0 -216
- package/dist/esm/schemas.js +0 -211
- package/dist/esm/schemas.js.map +0 -1
- package/dist/types/capabilities/index.d.ts +0 -32
- package/dist/types/capabilities/index.d.ts.map +0 -1
- package/dist/types/capabilities/overrides.d.ts +0 -27
- package/dist/types/capabilities/overrides.d.ts.map +0 -1
- package/dist/types/capabilities/paymaster.d.ts +0 -4
- package/dist/types/capabilities/paymaster.d.ts.map +0 -1
- package/dist/types/capabilities/permissions/index.d.ts +0 -139
- package/dist/types/capabilities/permissions/index.d.ts.map +0 -1
- package/dist/types/capabilities/permissions/mav2.d.ts +0 -37
- package/dist/types/capabilities/permissions/mav2.d.ts.map +0 -1
- package/dist/types/rpc/request.d.ts +0 -353
- package/dist/types/rpc/request.d.ts.map +0 -1
- package/dist/types/rpc/schema.d.ts +0 -343
- package/dist/types/rpc/schema.d.ts.map +0 -1
- package/dist/types/schemas.d.ts +0 -217
- package/dist/types/schemas.d.ts.map +0 -1
- package/src/capabilities/index.ts +0 -13
- package/src/capabilities/overrides.ts +0 -20
- package/src/capabilities/paymaster.ts +0 -5
- package/src/capabilities/permissions/index.ts +0 -142
- package/src/capabilities/permissions/mav2.ts +0 -127
- package/src/rpc/request.ts +0 -273
- package/src/rpc/schema.ts +0 -40
- package/src/schemas.ts +0 -257
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/remote/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAgB,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAkBlE,MAAM,UAAU,kBAAkB,CAChC,MAA+B;IAE/B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAE7C,MAAM,MAAM,GAAG,YAAY,CAAC;QAC1B,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAClB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC,CACvE,IAAI,CACL;QACH,KAAK;QACL,OAAO;KACR,CAAC;SACC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,GAAG,kBAAkB,CAAC,OAAO,CAAC;KAC/B,CAAC,CAAC;SACF,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACb,QAAQ,EAAE,sBAAsB,EAAE;KACnC,CAAC,CAAC,CAAC;IAEN,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,kBAAkB,GAAG,CACzB,SAAmC,EACf,EAAE;IACtB,OAAO;QACL,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC;gBAC9D,MAAM,EAAE,sBAAsB;gBAC9B,MAAM,EAAE,CAAC,MAAM,CAAC;aACjB,CAAC,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;YACvE,OAAO;gBACL,OAAO,EAAE,wBAAwB,CAAC;oBAChC,cAAc,EAAE,6BAA6B;oBAC7C,SAAS;oBACT,SAAS,EAAE,SAAS,CAAC,IAAI;iBAC1B,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Provider } from \"ox\";\nimport { createClient, custom, type Address } from \"viem\";\nimport { encodePermissionsContext } from \"@alchemy/wallet-api-types/capabilities\";\nimport { WalletServerRpcSchema } from \"@alchemy/wallet-api-types/rpc\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n InnerWalletApiClientBase,\n} from \"../types.ts\";\n\n/**\n * This is a low-level client just used to make RPC requests in remote mode\n * This should be wrapped by a higher-level smart account client that provides actions\n * that uses this client under the hood\n * @returns\n */\nexport function createRemoteClient<\n TAccount extends Address | undefined = Address | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient;\n\nexport function createRemoteClient(\n params: CreateInnerClientParams,\n): InnerWalletApiClient {\n const { transport, chain, account } = params;\n\n const client = createClient({\n transport: (opts) =>\n custom(Provider.from(transport(opts), { schema: WalletServerRpcSchema }))(\n opts,\n ),\n chain,\n account,\n })\n .extend((_client) => ({\n policyId: params.policyId,\n ...innerClientActions(_client),\n }))\n .extend(() => ({\n internal: internalStateDecorator(),\n }));\n\n return client;\n}\n\nconst innerClientActions = (\n apiClient: InnerWalletApiClientBase,\n): InnerClientActions => {\n return {\n grantPermissions: async (signer, params) => {\n const { sessionId, signatureRequest } = await apiClient.request({\n method: \"wallet_createSession\",\n params: [params],\n });\n const signature = await signSignatureRequest(signer, signatureRequest);\n return {\n context: encodePermissionsContext({\n contextVersion: \"REMOTE_MODE_DEFERRED_ACTION\",\n sessionId,\n signature: signature.data,\n }),\n };\n },\n };\n};\n"]}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
+
import type { SmartAccountSigner, SmartContractAccount } from "@aa-sdk/core";
|
|
1
2
|
import type { AlchemyTransport } from "@account-kit/infra";
|
|
2
|
-
import type { Address, Chain, Client, Hex,
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
export type CreateInnerClientParams<TAccount extends
|
|
3
|
+
import type { Address, Chain, Client, Hex, JsonRpcAccount, Transport } from "viem";
|
|
4
|
+
import type { GrantPermissionsParams, GrantPermissionsResult } from "./client/actions/grantPermissions.ts";
|
|
5
|
+
import type { RequestAccountParams } from "./client/actions/requestAccount.ts";
|
|
6
|
+
import type { WalletServerViemRpcSchema } from "@alchemy/wallet-api-types/rpc";
|
|
7
|
+
export type CreateInnerClientParams<TAccount extends Address | undefined = Address | undefined> = {
|
|
7
8
|
chain: Chain;
|
|
8
9
|
transport: AlchemyTransport;
|
|
9
10
|
policyId?: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
account: Address;
|
|
14
|
-
});
|
|
15
|
-
export type InnerWalletApiClientBase<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined, TExtend extends {
|
|
11
|
+
account?: TAccount | Address | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type InnerWalletApiClientBase<TExtend extends {
|
|
16
14
|
[key: string]: unknown;
|
|
17
15
|
} | undefined = {
|
|
18
16
|
[key: string]: unknown;
|
|
19
|
-
} | undefined> = Client<Transport, Chain,
|
|
17
|
+
} | undefined> = Client<Transport, Chain, JsonRpcAccount<Address> | undefined, WalletServerViemRpcSchema, {
|
|
20
18
|
policyId?: string;
|
|
21
19
|
} & TExtend>;
|
|
22
20
|
export type InnerClientActions = {
|
|
@@ -24,4 +22,20 @@ export type InnerClientActions = {
|
|
|
24
22
|
chainId: Hex;
|
|
25
23
|
}) => Promise<GrantPermissionsResult>;
|
|
26
24
|
};
|
|
27
|
-
export type
|
|
25
|
+
export type CachedAccount = {
|
|
26
|
+
account: SmartContractAccount;
|
|
27
|
+
requestParams: RequestAccountParams;
|
|
28
|
+
};
|
|
29
|
+
export type InternalState = {
|
|
30
|
+
setAccount: (account: CachedAccount) => void;
|
|
31
|
+
getAccount: () => CachedAccount | undefined;
|
|
32
|
+
};
|
|
33
|
+
export type InnerWalletApiClient = InnerWalletApiClientBase<InnerClientActions & {
|
|
34
|
+
internal: InternalState;
|
|
35
|
+
}>;
|
|
36
|
+
export type WithoutChainId<T> = T extends {
|
|
37
|
+
chainId: Hex;
|
|
38
|
+
} ? Omit<T, "chainId"> : T;
|
|
39
|
+
export type WithoutRawPayload<T> = T extends {
|
|
40
|
+
rawPayload: Hex;
|
|
41
|
+
} ? Omit<T, "rawPayload"> : T;
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AlchemyTransport } from \"@account-kit/infra\";\nimport type {\n Address,\n Chain,\n Client,\n Hex,\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SmartAccountSigner, SmartContractAccount } from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"@account-kit/infra\";\nimport type {\n Address,\n Chain,\n Client,\n Hex,\n JsonRpcAccount,\n Transport,\n} from \"viem\";\nimport type {\n GrantPermissionsParams,\n GrantPermissionsResult,\n} from \"./client/actions/grantPermissions.ts\";\nimport type { RequestAccountParams } from \"./client/actions/requestAccount.ts\";\nimport type { WalletServerViemRpcSchema } from \"@alchemy/wallet-api-types/rpc\";\n\nexport type CreateInnerClientParams<\n TAccount extends Address | undefined = Address | undefined,\n> = {\n chain: Chain;\n transport: AlchemyTransport;\n policyId?: string;\n account?: TAccount | Address | undefined;\n};\n\nexport type InnerWalletApiClientBase<\n TExtend extends { [key: string]: unknown } | undefined =\n | { [key: string]: unknown }\n | undefined,\n> = Client<\n Transport,\n Chain,\n JsonRpcAccount<Address> | undefined,\n WalletServerViemRpcSchema,\n { policyId?: string } & TExtend\n>;\n\nexport type InnerClientActions = {\n grantPermissions: (\n signer: SmartAccountSigner,\n params: GrantPermissionsParams & { chainId: Hex },\n ) => Promise<GrantPermissionsResult>;\n};\n\nexport type CachedAccount = {\n account: SmartContractAccount;\n requestParams: RequestAccountParams;\n};\n\nexport type InternalState = {\n setAccount: (account: CachedAccount) => void;\n getAccount: () => CachedAccount | undefined;\n};\n\nexport type InnerWalletApiClient = InnerWalletApiClientBase<\n InnerClientActions & { internal: InternalState }\n>;\n\nexport type WithoutChainId<T> = T extends { chainId: Hex }\n ? Omit<T, \"chainId\">\n : T;\n\nexport type WithoutRawPayload<T> = T extends { rawPayload: Hex }\n ? Omit<T, \"rawPayload\">\n : T;\n"]}
|
package/dist/esm/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Hex } from "viem";
|
|
2
|
+
export type Expect<T extends true> = T;
|
|
2
3
|
export declare const assertNever: (_val: never, msg: string) => never;
|
|
3
4
|
/** If the value is already Hex, it is returned unchanged. If it's a string, number or bigint, it's converted. */
|
|
4
5
|
export declare const castToHex: (val: string | number | bigint | Hex) => Hex;
|
package/dist/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAY,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAY,MAAM,MAAM,CAAC;AAI9C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAW,EAAE,GAAW,EAAS,EAAE;IAC7D,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF,iHAAiH;AACjH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAmC,EAAO,EAAE;IACpE,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACf,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC,CAAC","sourcesContent":["import { isHex, toHex, type Hex } from \"viem\";\n\nexport type Expect<T extends true> = T;\n\nexport const assertNever = (_val: never, msg: string): never => {\n throw new Error(msg);\n};\n\n/** If the value is already Hex, it is returned unchanged. If it's a string, number or bigint, it's converted. */\nexport const castToHex = (val: string | number | bigint | Hex): Hex => {\n if (isHex(val)) {\n return val;\n }\n return toHex(val);\n};\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { LightAccountFactoryAbi_V1_0_1 } from "./LightAccountFactoryAbi_V1_0_1";
|
|
2
|
-
export { LightAccountFactoryAbi_V1_0_2 } from "./LightAccountFactoryAbi_V1_0_2";
|
|
3
|
-
export { LightAccountFactoryAbi_V1_1_0 } from "./LightAccountFactoryAbi_V1_1_0";
|
|
4
|
-
export { LightAccountFactoryAbi_V2_0_0 } from "./LightAccountFactoryAbi_V2_0_0";
|
|
5
|
-
export { ModularAccountFactoryAbi_V2_0_0 } from "./ModularAccountFactoryAbi_V2_0_0";
|
|
6
|
-
export { MultiOwnerLightAccountFactoryAbi_V2_0_0 } from "./MultiOwnerLightAccountFactoryAbi_V2_0_0";
|
|
7
|
-
export { MultiOwnerModularAccountFactoryAbi_V1_0_0 } from "./MultiOwnerModularAccountFactoryAbi_V1_0_0";
|
|
8
|
-
export { MultisigModularAccountFactoryAbi_V1_0_0 } from "./MultisigModularAccountFactoryAbi_V1_0_0";
|
|
1
|
+
export { LightAccountFactoryAbi_V1_0_1 } from "./LightAccountFactoryAbi_V1_0_1.js";
|
|
2
|
+
export { LightAccountFactoryAbi_V1_0_2 } from "./LightAccountFactoryAbi_V1_0_2.js";
|
|
3
|
+
export { LightAccountFactoryAbi_V1_1_0 } from "./LightAccountFactoryAbi_V1_1_0.js";
|
|
4
|
+
export { LightAccountFactoryAbi_V2_0_0 } from "./LightAccountFactoryAbi_V2_0_0.js";
|
|
5
|
+
export { ModularAccountFactoryAbi_V2_0_0 } from "./ModularAccountFactoryAbi_V2_0_0.js";
|
|
6
|
+
export { MultiOwnerLightAccountFactoryAbi_V2_0_0 } from "./MultiOwnerLightAccountFactoryAbi_V2_0_0.js";
|
|
7
|
+
export { MultiOwnerModularAccountFactoryAbi_V1_0_0 } from "./MultiOwnerModularAccountFactoryAbi_V1_0_0.js";
|
|
8
|
+
export { MultisigModularAccountFactoryAbi_V1_0_0 } from "./MultisigModularAccountFactoryAbi_V1_0_0.js";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/abi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/abi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,uCAAuC,EAAE,MAAM,8CAA8C,CAAC;AACvG,OAAO,EAAE,yCAAyC,EAAE,MAAM,gDAAgD,CAAC;AAC3G,OAAO,EAAE,uCAAuC,EAAE,MAAM,8CAA8C,CAAC"}
|
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import type { Static } from "@sinclair/typebox";
|
|
3
3
|
import type { Address } from "abitype";
|
|
4
|
-
import type { wallet_createAccount } from "
|
|
5
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
4
|
+
import type { wallet_createAccount } from "@alchemy/wallet-api-types/rpc";
|
|
5
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
6
6
|
export type CreateAccountParams = Omit<Extract<Static<typeof wallet_createAccount>["Request"]["params"][0], {
|
|
7
7
|
signerAddress: Address;
|
|
8
8
|
}>, "signerAddress">;
|
|
9
9
|
export type CreateAccountResult = Static<typeof wallet_createAccount>["ReturnType"];
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new account for the provided signer using the wallet API client.
|
|
12
|
+
* This method is primarily used to import existing accounts.
|
|
13
|
+
* For most cases, you should use requestAccount instead.
|
|
14
|
+
* If the account already exists, an error will be thrown.
|
|
15
|
+
*
|
|
16
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
17
|
+
* @param {SmartAccountSigner} signer - The signer that will be associated with the account
|
|
18
|
+
* @param {CreateAccountParams} params - Parameters for creating the account
|
|
19
|
+
* @param {string} [params.id] - Optional UUID v4 identifier for the account
|
|
20
|
+
* @param {object} params.creationOptions - Options for account creation
|
|
21
|
+
* @param {string} [params.creationOptions.accountType] - Currently only "sma-b" (Modular Account v2) is supported
|
|
22
|
+
* @param {string} [params.creationOptions.salt] - Optional hex string to use as salt for account creation
|
|
23
|
+
* @returns {Promise<CreateAccountResult>} A Promise that resolves to the created account information
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Create a new account with a custom salt
|
|
27
|
+
* const account = await client.createAccount({
|
|
28
|
+
* creationOptions: {
|
|
29
|
+
* accountType: "sma-b",
|
|
30
|
+
* salt: "0x04"
|
|
31
|
+
* }
|
|
32
|
+
* });
|
|
33
|
+
* console.log(`Created account at address: ${account.accountAddress}`);
|
|
34
|
+
*/
|
|
10
35
|
export declare function createAccount(client: InnerWalletApiClient, signer: SmartAccountSigner, params: CreateAccountParams): Promise<CreateAccountResult>;
|
|
11
36
|
//# sourceMappingURL=createAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/createAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/createAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,OAAO,CACL,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC3D;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CAC3B,EACD,eAAe,CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC,OAAO,oBAAoB,CAC5B,CAAC,YAAY,CAAC,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAK9B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Static } from "@sinclair/typebox";
|
|
2
|
+
import type { wallet_formatSign } from "@alchemy/wallet-api-types/rpc";
|
|
3
|
+
import type { InnerWalletApiClient, WithoutChainId } from "../../types.ts";
|
|
4
|
+
import { type Address, type IsUndefined } from "viem";
|
|
5
|
+
export type FormatSignParams<TAccount extends Address | undefined = Address | undefined> = Omit<WithoutChainId<Static<(typeof wallet_formatSign)["properties"]["Request"]["properties"]["params"]>[0]>, "from"> & (IsUndefined<TAccount> extends true ? {
|
|
6
|
+
from: Address;
|
|
7
|
+
} : {
|
|
8
|
+
from?: never;
|
|
9
|
+
});
|
|
10
|
+
export type FormatSignResult = Static<typeof wallet_formatSign>["ReturnType"];
|
|
11
|
+
/**
|
|
12
|
+
* Formats a signature request for signing messages or transactions.
|
|
13
|
+
*
|
|
14
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
15
|
+
* @param {FormatSignParams} params - Parameters for formatting the signature
|
|
16
|
+
* @returns {Promise<FormatSignResult>} A Promise that resolves to the formatSign result containing the formatted signature.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Formats a signature
|
|
20
|
+
* const result = await client.formatSign({
|
|
21
|
+
* from: "0x1234...",
|
|
22
|
+
* signature: {
|
|
23
|
+
* type: "ecdsa",
|
|
24
|
+
* data: "0xabcd..."
|
|
25
|
+
* },
|
|
26
|
+
* });
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatSign<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, params: FormatSignParams<TAccount>): Promise<FormatSignResult>;
|
|
29
|
+
//# sourceMappingURL=formatSign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatSign.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/formatSign.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAS,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,MAAM,CAAC;AAG7D,MAAM,MAAM,gBAAgB,CAC1B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,IAAI,CACN,cAAc,CACZ,MAAM,CACJ,CAAC,OAAO,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC5E,CAAC,CAAC,CAAC,CACL,EACD,MAAM,CACP,GACC,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAAC;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GACjC,OAAO,CAAC,gBAAgB,CAAC,CAU3B"}
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
1
|
+
import type { GetCallsStatusParams as IsomorphicGetCallsStatusParams, GetCallsStatusResponse as IsomorphicGetCallsStatusResult } from "../../isomorphic/actions/getCallsStatus.ts";
|
|
2
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
3
|
export type GetCallsStatusParams = IsomorphicGetCallsStatusParams;
|
|
5
4
|
export type GetCallsStatusResult = IsomorphicGetCallsStatusResult;
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Gets the status of a prepared call by its ID.
|
|
7
|
+
* This method is used to check the execution status of calls sent via sendPreparedCalls.
|
|
8
|
+
*
|
|
9
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
10
|
+
* @param {GetCallsStatusParams} params - The ID of the prepared call to check
|
|
11
|
+
* @returns {Promise<GetCallsStatusResult>} A Promise that resolves to the status information including:
|
|
12
|
+
* - id: The hex ID of the call
|
|
13
|
+
* - chainId: The chain ID in hex format
|
|
14
|
+
* - status: The current status of the batch execution
|
|
15
|
+
* - receipts: Optional array of transaction receipts if the batch has been executed
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // After sending prepared calls
|
|
19
|
+
* const sendResult = await client.sendPreparedCalls({...});
|
|
20
|
+
*
|
|
21
|
+
* // Check the status of the first call ID
|
|
22
|
+
* const status = await client.getCallsStatus(sendResult.preparedCallIds[0]);
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCallsStatus(client: InnerWalletApiClient, params: GetCallsStatusParams): Promise<GetCallsStatusResult>;
|
|
7
25
|
//# sourceMappingURL=getCallsStatus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCallsStatus.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/getCallsStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getCallsStatus.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/getCallsStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,IAAI,8BAA8B,EACtD,sBAAsB,IAAI,8BAA8B,EACzD,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAElE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC,CAK/B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
export type GrantPermissionsParams<TAccount extends
|
|
1
|
+
import { type SmartAccountSigner } from "@aa-sdk/core";
|
|
2
|
+
import { type Address, type Hex, type IsUndefined } from "viem";
|
|
3
|
+
import type { CreateSessionParams } from "../../isomorphic/actions/createSession.ts";
|
|
4
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
5
|
+
export type GrantPermissionsParams<TAccount extends Address | undefined = Address | undefined> = Omit<CreateSessionParams, "account" | "chainId" | "entityId"> & (IsUndefined<TAccount> extends true ? {
|
|
6
6
|
account: Address;
|
|
7
7
|
} : {
|
|
8
8
|
account?: never;
|
|
@@ -10,5 +10,62 @@ export type GrantPermissionsParams<TAccount extends JsonRpcAccount<Address> | un
|
|
|
10
10
|
export type GrantPermissionsResult = {
|
|
11
11
|
context: Hex;
|
|
12
12
|
};
|
|
13
|
-
|
|
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.expirySec - 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 preparedCalls = 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 signedCalls = await client.signPreparedCalls(
|
|
58
|
+
* sessionKey,
|
|
59
|
+
* preparedCalls,
|
|
60
|
+
* );
|
|
61
|
+
*
|
|
62
|
+
* // Send the prepared call using the session key
|
|
63
|
+
* const result = await client.sendPreparedCalls({
|
|
64
|
+
* ...signedCalls,
|
|
65
|
+
* capabilities: {
|
|
66
|
+
* permissions,
|
|
67
|
+
* },
|
|
68
|
+
* });
|
|
69
|
+
*/
|
|
70
|
+
export declare function grantPermissions<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, signer: SmartAccountSigner, params: GrantPermissionsParams<TAccount>): Promise<GrantPermissionsResult>;
|
|
14
71
|
//# sourceMappingURL=grantPermissions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grantPermissions.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/grantPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"grantPermissions.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/grantPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,WAAW,EAAS,MAAM,MAAM,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,sBAAsB,CAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,IAAI,CAAC,mBAAmB,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC,GAC/D,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAC/B;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GACpB;IAAE,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAE3B,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,sBAAsB,CAAC,QAAQ,CAAC,GACvC,OAAO,CAAC,sBAAsB,CAAC,CAWjC"}
|
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
import type { Static } from "@sinclair/typebox";
|
|
2
|
-
import type { wallet_listAccounts } from "
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
4
|
-
|
|
2
|
+
import type { wallet_listAccounts } from "@alchemy/wallet-api-types/rpc";
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
|
+
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
5
|
+
import type { Address } from "viem";
|
|
6
|
+
export type ListAccountsParams = Omit<Static<typeof wallet_listAccounts>["Request"]["params"][0], "signerAddress"> & {
|
|
7
|
+
signerAddress?: Address;
|
|
8
|
+
};
|
|
5
9
|
export type ListAccountsResult = Static<typeof wallet_listAccounts>["ReturnType"];
|
|
6
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Lists all smart accounts for a given signer using the wallet API client.
|
|
12
|
+
*
|
|
13
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
14
|
+
* @param {ListAccountsParams} params - Parameters for listing accounts
|
|
15
|
+
* @param {string} params.signerAddress - The address of the signer to list accounts for
|
|
16
|
+
* @param {number} [params.limit] - Optional maximum number of accounts to return (default: 100, max: 100)
|
|
17
|
+
* @param {string} [params.after] - Optional pagination cursor for fetching subsequent pages
|
|
18
|
+
* @returns {Promise<ListAccountsResult>} A Promise that resolves to the list of accounts and pagination metadata
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Fetch the first page of accounts
|
|
22
|
+
* const firstPage = await client.listAccounts({
|
|
23
|
+
* signerAddress: "0x123...",
|
|
24
|
+
* limit: 10
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // If an 'after' cursor exists, use it to fetch the next page
|
|
28
|
+
* const nextPage = await client.listAccounts({
|
|
29
|
+
* signerAddress: "0x123...",
|
|
30
|
+
* limit: 10,
|
|
31
|
+
* after: firstPage.meta.after
|
|
32
|
+
* });
|
|
33
|
+
*/
|
|
34
|
+
export declare function listAccounts(client: InnerWalletApiClient, signer: SmartAccountSigner, params: ListAccountsParams): Promise<ListAccountsResult>;
|
|
7
35
|
//# sourceMappingURL=listAccounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listAccounts.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/listAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"listAccounts.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/listAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC1D,eAAe,CAChB,GAAG;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhC,MAAM,MAAM,kBAAkB,GAAG,MAAM,CACrC,OAAO,mBAAmB,CAC3B,CAAC,YAAY,CAAC,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,CAAC,CAY7B"}
|
|
@@ -1,16 +1,42 @@
|
|
|
1
|
-
import { type Address, type IsUndefined
|
|
2
|
-
import type { PrepareCallsParams as IsomorphicPrepareCallsParams, PrepareCallsResult as IsomorphicPrepareCallsResult } from "../../isomorphic/actions/prepareCalls";
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
1
|
+
import { type Address, type IsUndefined } from "viem";
|
|
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
|
} : {
|
|
7
|
-
account?:
|
|
7
|
+
account?: Address;
|
|
8
8
|
};
|
|
9
|
-
export type PrepareCallsParams<TAccount extends
|
|
9
|
+
export type PrepareCallsParams<TAccount extends Address | undefined = Address | undefined> = Omit<IsomorphicPrepareCallsParams, "from" | "chainId"> & (IsUndefined<TAccount> extends true ? {
|
|
10
10
|
from: Address;
|
|
11
11
|
} : {
|
|
12
12
|
from?: never;
|
|
13
13
|
});
|
|
14
14
|
export type PrepareCallsResult = IsomorphicPrepareCallsResult;
|
|
15
|
-
|
|
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 sponsored 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
|
+
*/
|
|
41
|
+
export declare function prepareCalls<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, params: PrepareCallsParams<TAccount>): Promise<PrepareCallsResult>;
|
|
16
42
|
//# sourceMappingURL=prepareCalls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/prepareCalls.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prepareCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/prepareCalls.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,MAAM,CAAC;AAC7D,OAAO,KAAK,EACV,kBAAkB,IAAI,4BAA4B,EAClD,kBAAkB,IAAI,4BAA4B,EACnD,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,eAAe,CAAC,QAAQ,IAClC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAC9B;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GACpB;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE5B,MAAM,MAAM,kBAAkB,CAC5B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,IAAI,CAAC,4BAA4B,EAAE,MAAM,GAAG,SAAS,CAAC,GACxD,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAE9E,MAAM,MAAM,kBAAkB,GAAG,4BAA4B,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,YAAY,CAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GACnC,OAAO,CAAC,kBAAkB,CAAC,CAuB7B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
2
|
+
import { type Address, type IsUndefined } from "viem";
|
|
3
|
+
import type { PrepareSignParams as IsomorphicPrepareSignParams, PrepareSignResult as IsomorphicPrepareSignResult } from "../../isomorphic/actions/prepareSign.ts";
|
|
4
|
+
export type PrepareSignParams<TAccount extends Address | undefined = Address | undefined> = Omit<IsomorphicPrepareSignParams, "from" | "chainId"> & (IsUndefined<TAccount> extends true ? {
|
|
5
|
+
from: Address;
|
|
6
|
+
} : {
|
|
7
|
+
from?: never;
|
|
8
|
+
});
|
|
9
|
+
export type PrepareSignResult = IsomorphicPrepareSignResult;
|
|
10
|
+
/**
|
|
11
|
+
* Prepares a signature request for signing messages or transactions.
|
|
12
|
+
*
|
|
13
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
14
|
+
* @param {PrepareSignParams} params - Parameters for preparing the signature request
|
|
15
|
+
* @returns {Promise<PrepareSignResult>} A Promise that resolves to the prepare sign result containing a signature request
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Prepare a message to be signed
|
|
19
|
+
* const result = await client.prepareSign({
|
|
20
|
+
* from: "0x1234...",
|
|
21
|
+
* type: "personal_sign",
|
|
22
|
+
* data: "Hello, world!",
|
|
23
|
+
* });
|
|
24
|
+
*/
|
|
25
|
+
export declare function prepareSign<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, params: PrepareSignParams<TAccount>): Promise<PrepareSignResult>;
|
|
26
|
+
//# sourceMappingURL=prepareSign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareSign.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/prepareSign.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAS,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,MAAM,CAAC;AAC7D,OAAO,KAAK,EACV,iBAAiB,IAAI,2BAA2B,EAChD,iBAAiB,IAAI,2BAA2B,EACjD,MAAM,yCAAyC,CAAC;AAGjD,MAAM,MAAM,iBAAiB,CAC3B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,IAAI,CAAC,2BAA2B,EAAE,MAAM,GAAG,SAAS,CAAC,GACvD,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAE9E,MAAM,MAAM,iBAAiB,GAAG,2BAA2B,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GAClC,OAAO,CAAC,iBAAiB,CAAC,CAU5B"}
|
|
@@ -1,12 +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
|
-
import
|
|
5
|
-
import type {
|
|
6
|
-
|
|
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], {
|
|
4
|
+
import type { wallet_requestAccount } from "@alchemy/wallet-api-types/rpc";
|
|
5
|
+
import type { InnerWalletApiClient } from "../../types.js";
|
|
6
|
+
export type RequestAccountParams = Omit<Extract<Static<typeof wallet_requestAccount>["Request"]["params"][0], {
|
|
8
7
|
signerAddress: Address;
|
|
9
|
-
}>, "signerAddress" | "includeCounterfactualInfo">
|
|
8
|
+
}>, "signerAddress" | "includeCounterfactualInfo"> & {
|
|
9
|
+
accountAddress?: Address;
|
|
10
|
+
};
|
|
10
11
|
export type RequestAccountResult = SmartContractAccount;
|
|
11
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Requests an account for the provided signer using the wallet API client.
|
|
14
|
+
* If an account already exists for the signer, it will always return that account unless a new ID is specified.
|
|
15
|
+
* If an account already exists, the creationHint will be ignored.
|
|
16
|
+
*
|
|
17
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
18
|
+
* @param {SmartAccountSigner} signer - The signer that will be associated with the account
|
|
19
|
+
* @param {RequestAccountParams} [params] - Optional parameters for requesting a specific account
|
|
20
|
+
* @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
|
|
21
|
+
* @param {object} [params.creationHint] - Optional hints to guide account creation. These are ignored if an account already exists
|
|
22
|
+
* @returns {Promise<RequestAccountResult>} A Promise that resolves to a SmartContractAccount instance
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Request an account with default parameters using a local signer
|
|
26
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner("0x...");
|
|
27
|
+
* const account = await client.requestAccount(signer);
|
|
28
|
+
*/
|
|
29
|
+
export declare function requestAccount(client: InnerWalletApiClient, signer: SmartAccountSigner, params?: RequestAccountParams): Promise<RequestAccountResult>;
|
|
12
30
|
//# sourceMappingURL=requestAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/requestAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"requestAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/requestAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,OAAO,CACL,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC5D;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CAC3B,EACD,eAAe,GAAG,2BAA2B,CAC9C,GAAG;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjC,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAExD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,CAAC,EAAE,oBAAoB,GAC5B,OAAO,CAAC,oBAAoB,CAAC,CA4C/B"}
|
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
import type { Static
|
|
2
|
-
import type { wallet_sendPreparedCalls } from "
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
4
|
-
export type SendPreparedCallsParams =
|
|
1
|
+
import type { Static } from "@sinclair/typebox";
|
|
2
|
+
import type { wallet_sendPreparedCalls } from "@alchemy/wallet-api-types/rpc";
|
|
3
|
+
import type { InnerWalletApiClient, WithoutChainId } from "../../types.ts";
|
|
4
|
+
export type SendPreparedCallsParams = WithoutChainId<Static<(typeof wallet_sendPreparedCalls)["properties"]["Request"]["properties"]["params"]>[0]>;
|
|
5
5
|
export type SendPreparedCallsResult = Static<typeof wallet_sendPreparedCalls>["ReturnType"];
|
|
6
|
+
/**
|
|
7
|
+
* Sends prepared calls by submitting a signed user operation.
|
|
8
|
+
* This method is used after signing the signature request returned from prepareCalls.
|
|
9
|
+
*
|
|
10
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
11
|
+
* @param {SendPreparedCallsParams} params - Parameters for sending prepared calls
|
|
12
|
+
* @returns {Promise<SendPreparedCallsResult>} A Promise that resolves to the result containing the prepared call IDs
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // First prepare the calls
|
|
16
|
+
* const preparedCalls = await client.prepareCalls({
|
|
17
|
+
* calls: [{
|
|
18
|
+
* to: "0x1234...",
|
|
19
|
+
* data: "0xabcdef...",
|
|
20
|
+
* value: "0x0"
|
|
21
|
+
* }],
|
|
22
|
+
* capabilities: {
|
|
23
|
+
* paymasterService: { policyId: "your-policy-id" }
|
|
24
|
+
* }
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Then sign the calls
|
|
28
|
+
* const signedCalls = await client.signPreparedCalls(preparedCalls);
|
|
29
|
+
*
|
|
30
|
+
* // Then send the prepared calls with the signature
|
|
31
|
+
* const result = await client.sendPreparedCalls({
|
|
32
|
+
* signedCalls,
|
|
33
|
+
* });
|
|
34
|
+
*/
|
|
6
35
|
export declare function sendPreparedCalls(client: InnerWalletApiClient, params: SendPreparedCallsParams): Promise<SendPreparedCallsResult>;
|
|
7
36
|
//# sourceMappingURL=sendPreparedCalls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendPreparedCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/sendPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"sendPreparedCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/sendPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE3E,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAClD,MAAM,CACJ,CAAC,OAAO,wBAAwB,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CACnF,CAAC,CAAC,CAAC,CACL,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAC1C,OAAO,wBAAwB,CAChC,CAAC,YAAY,CAAC,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC,CAYlC"}
|