@account-kit/wallet-client 4.84.0 → 4.84.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/client/actions/grantPermissions.d.ts +1 -1
- package/dist/esm/client/actions/grantPermissions.js +1 -5
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/listAccounts.d.ts +4 -8
- package/dist/esm/client/actions/listAccounts.js +6 -27
- package/dist/esm/client/actions/listAccounts.js.map +1 -1
- package/dist/esm/client/actions/requestAccount.d.ts +3 -6
- package/dist/esm/client/actions/requestAccount.js +5 -31
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/sendCalls.d.ts +1 -1
- package/dist/esm/client/actions/sendCalls.js +1 -5
- package/dist/esm/client/actions/sendCalls.js.map +1 -1
- package/dist/esm/client/actions/signMessage.d.ts +1 -1
- package/dist/esm/client/actions/signMessage.js +1 -1
- package/dist/esm/client/actions/signMessage.js.map +1 -1
- package/dist/esm/client/actions/signPreparedCalls.d.ts +1 -1
- package/dist/esm/client/actions/signPreparedCalls.js +2 -5
- package/dist/esm/client/actions/signPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signSignatureRequest.d.ts +34 -9
- package/dist/esm/client/actions/signSignatureRequest.js +2 -30
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/actions/signTypedData.d.ts +1 -1
- package/dist/esm/client/actions/signTypedData.js +1 -1
- package/dist/esm/client/actions/signTypedData.js.map +1 -1
- package/dist/esm/client/decorator.js +1 -13
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/client/index.d.ts +2 -8
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/internal/account.d.ts +1 -1
- package/dist/esm/internal/account.js +1 -19
- package/dist/esm/internal/account.js.map +1 -1
- package/dist/esm/utils.d.ts +0 -6
- package/dist/esm/utils.js +1 -14
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/listAccounts.d.ts +4 -8
- package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
- package/dist/types/client/actions/requestAccount.d.ts +3 -6
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/sendCalls.d.ts +1 -1
- package/dist/types/client/actions/sendCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signMessage.d.ts +1 -1
- package/dist/types/client/actions/signPreparedCalls.d.ts +1 -1
- package/dist/types/client/actions/signPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts +34 -9
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/actions/signTypedData.d.ts +1 -1
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +2 -8
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/internal/account.d.ts +1 -1
- package/dist/types/internal/account.d.ts.map +1 -1
- package/dist/types/utils.d.ts +0 -6
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +6 -6
- package/src/client/actions/grantPermissions.ts +1 -8
- package/src/client/actions/listAccounts.ts +7 -35
- package/src/client/actions/requestAccount.ts +8 -51
- package/src/client/actions/sendCalls.ts +1 -7
- package/src/client/actions/signMessage.ts +1 -1
- package/src/client/actions/signPreparedCalls.ts +2 -7
- package/src/client/actions/signSignatureRequest.ts +5 -75
- package/src/client/actions/signTypedData.ts +1 -1
- package/src/client/decorator.ts +1 -19
- package/src/client/index.ts +2 -9
- package/src/internal/account.ts +2 -26
- package/src/utils.ts +1 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signSignatureRequest.js","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signSignatureRequest.js","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQ7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAa3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAyB,EACzB,MAAkC;IAElC,OAAO,CAAC,UAAU,CAAC;QACjB,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB;KACF,CAAC,CAAC;IAEH,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,eAAe,CAAC,CAAC,CAAC;YACrB,OAAO;gBACL,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;aAC5C,CAAC;QACJ,CAAC;QACD,KAAK,sBAAsB,CAAC,CAAC,CAAC;YAC5B,OAAO;gBACL,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,MAAM,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC;aAC9C,CAAC;QACJ,CAAC;QACD,KAAK,aAAa,CAAC,CAAC,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;YACjE,CAAC;YACD,MAAM,EACJ,CAAC,EACD,CAAC,EACD,CAAC,EACD,OAAO,EAAE,QAAQ,GAClB,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC;gBACjC,GAAG,MAAM,CAAC,IAAI;gBACd,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;gBACzC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;aACtC,CAAC,CAAC;YACH,MAAM,OAAO,GACX,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YAE9D,OAAO;gBACL,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,kBAAkB,CAAC;oBACvB,CAAC;oBACD,CAAC;oBACD,OAAO;iBACR,CAAC;aACH,CAAC;QACJ,CAAC;QACD;YACE,OAAO,WAAW,CAAC,MAAM,EAAE,oCAAoC,CAAC,CAAC;IACrE,CAAC;AACH,CAAC","sourcesContent":["import { hexToNumber, serializeSignature } from \"viem\";\nimport { assertNever } from \"../../utils.js\";\nimport type {\n PersonalSignSignatureRequest,\n TypedDataSignatureRequest,\n AuthorizationSignatureRequest,\n Eip7702UnsignedAuth,\n EcdsaSig,\n} from \"@alchemy/wallet-api-types\";\nimport { vToYParity } from \"ox/Signature\";\nimport type { WithoutRawPayload } from \"../../types.ts\";\nimport { metrics } from \"../../metrics.js\";\nimport type { SmartWalletSigner } from \"../index.js\";\n\nexport type SignSignatureRequestParams = WithoutRawPayload<\n | PersonalSignSignatureRequest\n | TypedDataSignatureRequest\n | (AuthorizationSignatureRequest & {\n data: Eip7702UnsignedAuth;\n })\n>;\n\nexport type SignSignatureRequestResult = EcdsaSig[\"signature\"];\n\n/**\n * Signs a signature request using the provided signer.\n * This method handles different types of signature requests including personal_sign, eth_signTypedData_v4, and authorization.\n *\n * @param {SmartAccountSigner} signer - The signer to use for signing the request\n * @param {SignSignatureRequestParams} params - The signature request parameters\n * @param {string} params.type - The type of signature request ('personal_sign', 'eth_signTypedData_v4', or 'signature_with_authorization')\n * @param {SignSignatureRequestParams[\"data\"]} params.data - The data to sign, format depends on the signature type\n * @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result\n *\n * @example\n * ```ts\n * // Sign a personal message\n * const result = await client.signSignatureRequest({\n * type: 'personal_sign',\n * data: 'Hello, world!'\n * });\n *\n * // Sign typed data (EIP-712)\n * const result = await client.signSignatureRequest({\n * type: 'eth_signTypedData_v4',\n * data: {\n * domain: { ... },\n * types: { ... },\n * primaryType: '...',\n * message: { ... }\n * }\n * });\n * ```\n */\nexport async function signSignatureRequest(\n signer: SmartWalletSigner,\n params: SignSignatureRequestParams,\n): Promise<EcdsaSig[\"signature\"]> {\n metrics.trackEvent({\n name: \"sign_signature_request\",\n data: {\n type: params.type,\n },\n });\n\n switch (params.type) {\n case \"personal_sign\": {\n return {\n type: \"secp256k1\",\n data: await signer.signMessage(params.data),\n };\n }\n case \"eth_signTypedData_v4\": {\n return {\n type: \"secp256k1\",\n data: await signer.signTypedData(params.data),\n };\n }\n case \"eip7702Auth\": {\n if (!signer.signAuthorization) {\n throw new Error(\"Signer does not implement signAuthorization\");\n }\n const {\n r,\n s,\n v,\n yParity: _yParity,\n } = await signer.signAuthorization({\n ...params.data,\n chainId: hexToNumber(params.data.chainId),\n nonce: hexToNumber(params.data.nonce),\n });\n const yParity =\n _yParity != null ? Number(_yParity) : vToYParity(Number(v));\n\n return {\n type: \"secp256k1\",\n data: serializeSignature({\n r,\n s,\n yParity,\n }),\n };\n }\n default:\n return assertNever(params, `Unexpected signature request type.`);\n }\n}\n"]}
|
|
@@ -10,7 +10,7 @@ export type SignTypedDataResult = Hex;
|
|
|
10
10
|
* This method requests the account associated with the signer and uses it to sign the typed data.
|
|
11
11
|
*
|
|
12
12
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
13
|
-
* @param {SmartAccountSigner
|
|
13
|
+
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
14
14
|
* @param {TypedDataDefinition} params - The typed data to sign, following EIP-712 format
|
|
15
15
|
* @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string
|
|
16
16
|
*
|
|
@@ -5,7 +5,7 @@ import { metrics } from "../../metrics.js";
|
|
|
5
5
|
* This method requests the account associated with the signer and uses it to sign the typed data.
|
|
6
6
|
*
|
|
7
7
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
8
|
-
* @param {SmartAccountSigner
|
|
8
|
+
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
9
9
|
* @param {TypedDataDefinition} params - The typed data to sign, following EIP-712 format
|
|
10
10
|
* @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string
|
|
11
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAS3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA4B,EAC5B,MAAyB,EACzB,MAA2B;IAE3B,OAAO,CAAC,UAAU,CAAC;QACjB,IAAI,EAAE,iBAAiB;KACxB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE;QACnD,cAAc,EAAE,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO;KAC1D,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import type { Address, Hex, TypedDataDefinition } from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport { requestAccount } from \"./requestAccount.js\";\nimport { metrics } from \"../../metrics.js\";\nimport type { SmartWalletSigner } from \"../index.js\";\n\nexport type SignTypedDataParams = TypedDataDefinition & {\n account?: Address;\n};\n\nexport type SignTypedDataResult = Hex;\n\n/**\n * Signs typed data (EIP-712) using the smart account.\n * This method requests the account associated with the signer and uses it to sign the typed data.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner
|
|
1
|
+
{"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAS3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA4B,EAC5B,MAAyB,EACzB,MAA2B;IAE3B,OAAO,CAAC,UAAU,CAAC;QACjB,IAAI,EAAE,iBAAiB;KACxB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE;QACnD,cAAc,EAAE,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO;KAC1D,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import type { Address, Hex, TypedDataDefinition } from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport { requestAccount } from \"./requestAccount.js\";\nimport { metrics } from \"../../metrics.js\";\nimport type { SmartWalletSigner } from \"../index.js\";\n\nexport type SignTypedDataParams = TypedDataDefinition & {\n account?: Address;\n};\n\nexport type SignTypedDataResult = Hex;\n\n/**\n * Signs typed data (EIP-712) using the smart account.\n * This method requests the account associated with the signer and uses it to sign the typed data.\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 {TypedDataDefinition} params - The typed data to sign, following EIP-712 format\n * @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string\n *\n * @example\n * ```ts\n * // Sign typed data\n * const signature = await client.signTypedData({\n * domain: {\n * name: 'Example DApp',\n * version: '1',\n * chainId: 1,\n * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'\n * },\n * types: {\n * Person: [\n * { name: 'name', type: 'string' },\n * { name: 'wallet', type: 'address' }\n * ]\n * },\n * primaryType: 'Person',\n * message: {\n * name: 'John Doe',\n * wallet: '0xAaAaAaAaAaAaAaAaAaAAAAAAAAaaaAaAaAaaAaAa'\n * }\n * });\n * ```\n */\nexport async function signTypedData(\n client: InnerWalletApiClient,\n signer: SmartWalletSigner,\n params: SignTypedDataParams,\n): Promise<SignTypedDataResult> {\n metrics.trackEvent({\n name: \"sign_typed_data\",\n });\n\n const account = await requestAccount(client, signer, {\n accountAddress: params.account ?? client.account?.address,\n });\n\n return account.signTypedDataWith6492(params);\n}\n"]}
|
|
@@ -10,18 +10,6 @@ import { signSignatureRequest, } from "./actions/signSignatureRequest.js";
|
|
|
10
10
|
import { signTypedData, } from "./actions/signTypedData.js";
|
|
11
11
|
import { signPreparedCalls, } from "./actions/signPreparedCalls.js";
|
|
12
12
|
import { sendCalls, } from "./actions/sendCalls.js";
|
|
13
|
-
import { isWebAuthnSigner } from "../utils.js";
|
|
14
|
-
async function signSignatureRequestSafe(signer, params) {
|
|
15
|
-
if (params.type === "eip7702Auth") {
|
|
16
|
-
if (isWebAuthnSigner(signer)) {
|
|
17
|
-
throw new Error("WebAuthn signer cannot sign EIP-7702 authorization requests");
|
|
18
|
-
}
|
|
19
|
-
// We must split up the call to signSignatureRequest across two conditionals for the TS compiler to
|
|
20
|
-
// correctly infer which overload to use.
|
|
21
|
-
return signSignatureRequest(signer, params);
|
|
22
|
-
}
|
|
23
|
-
return signSignatureRequest(signer, params);
|
|
24
|
-
}
|
|
25
13
|
export function smartWalletClientActions(client, signer) {
|
|
26
14
|
return {
|
|
27
15
|
requestAccount: (params) => requestAccount(client, signer, params),
|
|
@@ -31,7 +19,7 @@ export function smartWalletClientActions(client, signer) {
|
|
|
31
19
|
sendCalls: (params) => sendCalls(client, signer, params),
|
|
32
20
|
getCallsStatus: (params) => getCallsStatus(client, params),
|
|
33
21
|
waitForCallsStatus: (params) => waitForCallsStatus(client, params),
|
|
34
|
-
signSignatureRequest: (params) =>
|
|
22
|
+
signSignatureRequest: (params) => signSignatureRequest(signer, params),
|
|
35
23
|
signPreparedCalls: (params) => signPreparedCalls(signer, params),
|
|
36
24
|
signMessage: (params) => signMessage(client, signer, params),
|
|
37
25
|
signTypedData: (params) => signTypedData(client, signer, params),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,cAAc,GAGf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,GAGjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,YAAY,GAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,YAAY,GAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,GAGf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,GAGlB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,WAAW,EAA0B,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EACL,oBAAoB,GAGrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,aAAa,GAEd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,iBAAiB,GAGlB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,SAAS,GAGV,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,cAAc,GAGf,MA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,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC;QAClE,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC;QACtE,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;QAChE,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAC5D,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAChE,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;KACvE,CAAC;AACJ,CAAC","sourcesContent":["import type { Address, Hex } from \"viem\";\nimport type {\n WaitForCallsStatusParameters,\n WaitForCallsStatusReturnType,\n} from \"viem/actions\";\nimport type { InnerWalletApiClient } from \"../types.ts\";\nimport {\n getCallsStatus,\n type GetCallsStatusParams,\n type GetCallsStatusResult,\n} from \"./actions/getCallsStatus.js\";\nimport {\n grantPermissions,\n type GrantPermissionsParams,\n type GrantPermissionsResult,\n} from \"./actions/grantPermissions.js\";\nimport {\n listAccounts,\n type ListAccountsParams,\n type ListAccountsResult,\n} from \"./actions/listAccounts.js\";\nimport {\n prepareCalls,\n type PrepareCallsParams,\n type PrepareCallsResult,\n} from \"./actions/prepareCalls.js\";\nimport {\n requestAccount,\n type RequestAccountParams,\n type RequestAccountResult,\n} from \"./actions/requestAccount.js\";\nimport {\n sendPreparedCalls,\n type SendPreparedCallsParams,\n type SendPreparedCallsResult,\n} from \"./actions/sendPreparedCalls.js\";\nimport { waitForCallsStatus } from \"./actions/waitForCallsStatus.js\";\nimport { signMessage, type SignMessageParams } from \"./actions/signMessage.js\";\nimport {\n signSignatureRequest,\n type SignSignatureRequestParams,\n type SignSignatureRequestResult,\n} from \"./actions/signSignatureRequest.js\";\nimport {\n signTypedData,\n type SignTypedDataParams,\n} from \"./actions/signTypedData.js\";\nimport {\n signPreparedCalls,\n type SignPreparedCallsParams,\n type SignPreparedCallsResult,\n} from \"./actions/signPreparedCalls.js\";\nimport {\n sendCalls,\n type SendCallsParams,\n type SendCallsResult,\n} from \"./actions/sendCalls.js\";\nimport type { SmartWalletSigner } from \"./index.js\";\n\nexport type SmartWalletActions<\n TAccount extends Address | undefined = Address | undefined,\n> = {\n requestAccount: (\n params?: RequestAccountParams,\n ) => Promise<RequestAccountResult>;\n prepareCalls: (\n params: PrepareCallsParams<TAccount>,\n ) => Promise<PrepareCallsResult>;\n sendPreparedCalls: (\n params: SendPreparedCallsParams,\n ) => Promise<SendPreparedCallsResult>;\n sendCalls: (params: SendCallsParams<TAccount>) => Promise<SendCallsResult>;\n listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;\n getCallsStatus: (\n params: GetCallsStatusParams,\n ) => Promise<GetCallsStatusResult>;\n waitForCallsStatus: (\n params: WaitForCallsStatusParameters,\n ) => Promise<WaitForCallsStatusReturnType>;\n signSignatureRequest: (\n params: SignSignatureRequestParams,\n ) => Promise<SignSignatureRequestResult>;\n signPreparedCalls: (\n params: SignPreparedCallsParams,\n ) => Promise<SignPreparedCallsResult>;\n signMessage: (params: SignMessageParams) => Promise<Hex>;\n signTypedData: (params: SignTypedDataParams) => Promise<Hex>;\n grantPermissions: (\n params: GrantPermissionsParams<TAccount>,\n ) => Promise<GrantPermissionsResult>;\n};\n\nexport function smartWalletClientActions<\n TAccount extends Address | undefined = Address | undefined,\n>(\n client: InnerWalletApiClient,\n signer: SmartWalletSigner,\n): SmartWalletActions<TAccount> {\n return {\n requestAccount: (params) => requestAccount(client, signer, params),\n prepareCalls: (params) => prepareCalls(client, params),\n listAccounts: (params) => listAccounts(client, signer, params),\n sendPreparedCalls: (params) => sendPreparedCalls(client, params),\n sendCalls: (params) => sendCalls(client, signer, params),\n getCallsStatus: (params) => getCallsStatus(client, params),\n waitForCallsStatus: (params) => waitForCallsStatus(client, params),\n signSignatureRequest: (params) => signSignatureRequest(signer, params),\n signPreparedCalls: (params) => signPreparedCalls(signer, params),\n signMessage: (params) => signMessage(client, signer, params),\n signTypedData: (params) => signTypedData(client, signer, params),\n grantPermissions: (params) => grantPermissions(client, signer, params),\n };\n}\n"]}
|
|
@@ -3,13 +3,7 @@ import type { AlchemyTransport } from "@account-kit/infra";
|
|
|
3
3
|
import { type Address, type Chain, type Prettify } from "viem";
|
|
4
4
|
import type { InnerWalletApiClientBase } from "../types.ts";
|
|
5
5
|
import { type SmartWalletActions } from "./decorator.js";
|
|
6
|
-
|
|
7
|
-
export type WebAuthnSigner = {
|
|
8
|
-
credential: ToWebAuthnAccountParameters["credential"];
|
|
9
|
-
getFn?: ToWebAuthnAccountParameters["getFn"] | undefined;
|
|
10
|
-
rpId?: ToWebAuthnAccountParameters["rpId"] | undefined;
|
|
11
|
-
};
|
|
12
|
-
export type SmartWalletSigner = SmartAccountSigner<any> | WebAuthnSigner;
|
|
6
|
+
export type SmartWalletSigner = SmartAccountSigner<any>;
|
|
13
7
|
export type SmartWalletClientParams<TAccount extends Address | undefined = Address | undefined> = Prettify<{
|
|
14
8
|
transport: AlchemyTransport;
|
|
15
9
|
chain: Chain;
|
|
@@ -29,7 +23,7 @@ export type SmartWalletClient<TAccount extends Address | undefined = Address | u
|
|
|
29
23
|
* @param {SmartWalletClientParams} params - The parameters for creating the smart wallet client
|
|
30
24
|
* @param {AlchemyTransport} params.transport - The Alchemy transport to use
|
|
31
25
|
* @param {Chain} params.chain - The chain to use
|
|
32
|
-
* @param {SmartAccountSigner
|
|
26
|
+
* @param {SmartAccountSigner} params.signer - The signer to use for the smart account
|
|
33
27
|
* @param {string} [params.policyId] - The policy ID for gas sponsorship (optional)
|
|
34
28
|
* @param {Address} [params.account] - The smart account address to use (optional)
|
|
35
29
|
* @returns {SmartWalletClient} - A viem-compatible client
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,YAAY,EACZ,MAAM,GAEP,MAAM,MAAM,CAAC;AAEd,OAAO,EACL,wBAAwB,GAEzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAKzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,YAAY,EACZ,MAAM,GAEP,MAAM,MAAM,CAAC;AAEd,OAAO,EACL,wBAAwB,GAEzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAKzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAuDxC,MAAM,UAAU,uBAAuB,CACrC,MAA+B;IAE/B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAErD,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ;QAC/B,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QACnB,CAAC,CAAC,MAAM,CAAC,SAAS;YAChB,CAAC,CAAC,MAAM,CAAC,SAAS;YAClB,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,WAAW,GAAG,YAAY,CAK9B;QACA,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAClB,MAAM,CACJ,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;YAC7B,MAAM,EAAE,SAAS,CAAC,IAAI,EAA6B;SACpD,CAAC,CACH,CAAC,IAAI,CAAC;QACT,KAAK;QACL,OAAO;KACR,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACf,SAAS;QACT,QAAQ,EAAE,sBAAsB,EAAE;KACnC,CAAC,CAAC,CAAC;IAEJ,OAAO,CAAC,UAAU,CAAC;QACjB,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE;YACJ,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE;SACzB;KACF,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CACnC,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CACzC,CAAC;AACJ,CAAC;AAED,iBAAiB;AACjB,yDAAyD;AACzD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,MAAM;AAEN,gEAAgE;AAEhE,sDAAsD;AACtD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,0BAA0B;AAC1B,MAAM;AAEN,6DAA6D","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"@account-kit/infra\";\nimport {\n type Address,\n type Chain,\n type Prettify,\n type Transport,\n createClient,\n custom,\n type JsonRpcAccount,\n} from \"viem\";\nimport type { InnerWalletApiClientBase } from \"../types.ts\";\nimport {\n smartWalletClientActions,\n type SmartWalletActions,\n} from \"./decorator.js\";\nimport { Provider, RpcSchema } from \"ox\";\nimport type {\n WalletServerRpcSchemaType,\n WalletServerViemRpcSchema,\n} from \"@alchemy/wallet-api-types/rpc\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport { metrics } from \"../metrics.js\";\n\nexport type SmartWalletSigner = SmartAccountSigner<any>;\n\nexport type SmartWalletClientParams<\n TAccount extends Address | undefined = Address | undefined,\n> = Prettify<\n {\n transport: AlchemyTransport;\n chain: Chain;\n signer: SmartWalletSigner;\n account?: TAccount | Address | undefined;\n } & (\n | { policyId?: string; policyIds?: never }\n | { policyIds?: string[]; policyId?: never }\n )\n>;\n\nexport type SmartWalletClient<\n TAccount extends Address | undefined = Address | undefined,\n> = InnerWalletApiClientBase<SmartWalletActions<TAccount>>;\n\n/**\n * Creates a smart wallet client that can be used to interact with a smart account.\n *\n * @param {SmartWalletClientParams} params - The parameters for creating the smart wallet client\n * @param {AlchemyTransport} params.transport - The Alchemy transport to use\n * @param {Chain} params.chain - The chain to use\n * @param {SmartAccountSigner} params.signer - The signer to use for the smart account\n * @param {string} [params.policyId] - The policy ID for gas sponsorship (optional)\n * @param {Address} [params.account] - The smart account address to use (optional)\n * @returns {SmartWalletClient} - A viem-compatible client\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { alchemy, arbitrumSepolia } from \"@account-kit/infra\";\n * import { generatePrivateKey } from \"viem/accounts\";\n * import { createSmartWalletClient } from \"@account-kit/wallet-client\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const transport = alchemy({\n * apiKey: \"your-alchemy-api-key\",\n * });\n * const client = createSmartWalletClient({\n * transport,\n * chain: arbitrumSepolia,\n * signer,\n * });\n * ```\n */\nexport function createSmartWalletClient<\n TAccount extends Address | undefined = undefined,\n>(params: SmartWalletClientParams<TAccount>): SmartWalletClient<TAccount>;\n\nexport function createSmartWalletClient(\n params: SmartWalletClientParams,\n): SmartWalletClient {\n const { transport, chain, account, signer } = params;\n\n const policyIds = params.policyId\n ? [params.policyId]\n : params.policyIds\n ? params.policyIds\n : undefined;\n\n const innerClient = createClient<\n Transport,\n Chain,\n JsonRpcAccount<Address> | undefined,\n WalletServerViemRpcSchema\n >({\n transport: (opts) =>\n custom(\n Provider.from(transport(opts), {\n schema: RpcSchema.from<WalletServerRpcSchemaType>(),\n }),\n )(opts),\n chain,\n account,\n }).extend(() => ({\n policyIds,\n internal: internalStateDecorator(),\n }));\n\n metrics.trackEvent({\n name: \"client_created\",\n data: {\n chainId: params.chain.id,\n },\n });\n\n return innerClient.extend((client) =>\n smartWalletClientActions(client, signer),\n );\n}\n\n// Example usage:\n// const clientWithoutAccount = createSmartWalletClient({\n// transport: alchemy({ apiKey: \"123\" }),\n// chain: baseSepolia,\n// signer: createDummySigner(zeroAddress),\n// });\n\n// const account1 = await clientWithoutAccount.requestAccount();\n\n// const clientWithAccount = createSmartWalletClient({\n// transport: alchemy({ apiKey: \"123\" }),\n// chain: baseSepolia,\n// signer: createDummySigner(zeroAddress),\n// account: zeroAddress,\n// });\n\n// const account2 = await clientWithAccount.requestAccount();\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SmartContractAccount } from "@aa-sdk/core";
|
|
2
2
|
import { type Chain, type Transport, type Address } from "viem";
|
|
3
3
|
import type { SerializedInitcode } from "@alchemy/wallet-api-types";
|
|
4
4
|
import type { SmartWalletSigner } from "../client/index.js";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { InvalidSignerTypeError, } from "@aa-sdk/core";
|
|
2
1
|
import { createModularAccountV2, createLightAccount, createMultiOwnerLightAccount, createMultiOwnerModularAccount, } from "@account-kit/smart-contracts";
|
|
3
2
|
import { concatHex, isAddressEqual, } from "viem";
|
|
4
3
|
import { InternalError, InvalidRequestError } from "ox/RpcResponse";
|
|
5
|
-
import { assertNever
|
|
4
|
+
import { assertNever } from "../utils.js";
|
|
6
5
|
import { metrics } from "../metrics.js";
|
|
7
6
|
/**
|
|
8
7
|
* Creates a smart account instance from the given parameters.
|
|
@@ -29,9 +28,6 @@ export async function createAccount(params) {
|
|
|
29
28
|
if (!isAddressEqual(params.delegation, MAV2_7702_DELEGATION_ADDRESS)) {
|
|
30
29
|
throw new Error("7702 mode currently only supports ModularAccountV2");
|
|
31
30
|
}
|
|
32
|
-
if (isWebAuthnSigner(signer)) {
|
|
33
|
-
throw new InvalidSignerTypeError("WebAuthn");
|
|
34
|
-
}
|
|
35
31
|
return createModularAccountV2({
|
|
36
32
|
...accountParams,
|
|
37
33
|
signer,
|
|
@@ -57,20 +53,6 @@ export async function createAccount(params) {
|
|
|
57
53
|
: (params.counterfactualInfo?.factoryType ?? "unknown"),
|
|
58
54
|
},
|
|
59
55
|
});
|
|
60
|
-
// WebAuthn accounts must use a different signer type, so they are handled separately.
|
|
61
|
-
if (factoryType === "MAv2.0.0-ma-webauthn") {
|
|
62
|
-
if (!isWebAuthnSigner(signer)) {
|
|
63
|
-
throw new InvalidSignerTypeError(signer.signerType);
|
|
64
|
-
}
|
|
65
|
-
return createModularAccountV2({
|
|
66
|
-
...commonParams,
|
|
67
|
-
...signer,
|
|
68
|
-
mode: "webauthn",
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
if (isWebAuthnSigner(signer)) {
|
|
72
|
-
throw new InvalidSignerTypeError("WebAuthn");
|
|
73
|
-
}
|
|
74
56
|
// Return the account created based on the factory type
|
|
75
57
|
switch (factoryType) {
|
|
76
58
|
case "MAv2.0.0-sma-b":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/internal/account.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/internal/account.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,SAAS,EAIT,cAAc,GACf,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAYxC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA2B;IAE3B,MAAM,EAAE,k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aAClB,CAAC,CAAC;QACL,KAAK,oBAAoB;YACvB,OAAO,kBAAkB,CAAC;gBACxB,GAAG,YAAY;gBACf,MAAM;gBACN,OAAO,EAAE,QAAQ;aAClB,CAAC,CAAC;QACL,KAAK,oBAAoB;YACvB,OAAO,kBAAkB,CAAC;gBACxB,GAAG,YAAY;gBACf,MAAM;gBACN,OAAO,EAAE,QAAQ;aAClB,CAAC,CAAC;QACL,KAAK,oBAAoB;YACvB,OAAO,kBAAkB,CAAC;gBACxB,GAAG,YAAY;gBACf,MAAM;gBACN,OAAO,EAAE,QAAQ;aAClB,CAAC,CAAC;QACL,KAAK,qBAAqB;YACxB,OAAO,8BAA8B,CAAC;gBACpC,GAAG,YAAY;gBACf,MAAM;aACP,CAAC,CAAC;QACL,KAAK,+BAA+B;YAClC,OAAO,4BAA4B,CAAC;gBAClC,GAAG,YAAY;gBACf,OAAO,EAAE,QAAQ;gBACjB,MAAM;aACP,CAAC,CAAC;QACL,KAAK,mBAAmB,CAAC;QACzB,KAAK,iBAAiB,CAAC;QACvB,KAAK,SAAS,CAAC;QACf,KAAK,SAAS;YACZ,MAAM,IAAI,mBAAmB,CAAC;gBAC5B,OAAO,EAAE,uCAAuC,WAAW,EAAE;aAC9D,CAAC,CAAC;QACL;YACE,OAAO,WAAW,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,MAAM,4BAA4B,GAChC,4CAA4C,CAAC","sourcesContent":["import type { SmartContractAccount } from \"@aa-sdk/core\";\nimport {\n createModularAccountV2,\n createLightAccount,\n createMultiOwnerLightAccount,\n createMultiOwnerModularAccount,\n} from \"@account-kit/smart-contracts\";\nimport {\n concatHex,\n type Chain,\n type Transport,\n type Address,\n isAddressEqual,\n} from \"viem\";\nimport type { SerializedInitcode } from \"@alchemy/wallet-api-types\";\nimport { InternalError, InvalidRequestError } from \"ox/RpcResponse\";\nimport { assertNever } from \"../utils.js\";\nimport { metrics } from \"../metrics.js\";\nimport type { SmartWalletSigner } from \"../client/index.js\";\n\ntype CreateAccountParams = {\n chain: Chain;\n transport: Transport;\n signer: SmartWalletSigner;\n accountAddress: Address;\n counterfactualInfo?: SerializedInitcode; // undefined for 7702 accounts\n delegation?: Address; // for 7702 accounts\n};\n\n/**\n * Creates a smart account instance from the given parameters.\n *\n * @param {CreateAccountParams} params - The parameters for creating a smart account.\n * @returns {Promise<SmartContractAccount>} A promise that resolves to the created smart account.\n *\n * @example\n * ```ts\n * // Create a smart account\n * const account = await createAccount({\n * chain: arbitrumSepolia,\n * transport: alchemy({\n * apiKey: \"your-alchemy-api-key\",\n * }),\n * signer: signer,\n * accountAddress: \"0x1234...\",\n * });\n * ```\n */\nexport async function createAccount(\n params: CreateAccountParams,\n): Promise<SmartContractAccount> {\n const { counterfactualInfo: ci, signer, ...accountParams } = params;\n\n if (params.delegation) {\n if (!isAddressEqual(params.delegation, MAV2_7702_DELEGATION_ADDRESS)) {\n throw new Error(\"7702 mode currently only supports ModularAccountV2\");\n }\n\n return createModularAccountV2({\n ...accountParams,\n signer,\n mode: \"7702\",\n });\n }\n\n if (!ci) {\n throw new InternalError({\n message: \"Counterfactual info not found\",\n });\n }\n\n const factoryType = ci.factoryType;\n const commonParams = {\n ...accountParams,\n initCode: concatHex([ci.factoryAddress, ci.factoryData]),\n };\n\n metrics.trackEvent({\n name: \"account_initialized\",\n data: {\n chainId: params.chain.id,\n factory: params.delegation\n ? \"7702\"\n : (params.counterfactualInfo?.factoryType ?? \"unknown\"),\n },\n });\n\n // Return the account created based on the factory type\n switch (factoryType) {\n case \"MAv2.0.0-sma-b\":\n return createModularAccountV2({\n ...commonParams,\n signer,\n mode: \"default\",\n });\n case \"LightAccountV2.0.0\":\n return createLightAccount({\n ...commonParams,\n signer,\n version: \"v2.0.0\",\n });\n case \"LightAccountV1.0.1\":\n return createLightAccount({\n ...commonParams,\n signer,\n version: \"v1.0.1\",\n });\n case \"LightAccountV1.0.2\":\n return createLightAccount({\n ...commonParams,\n signer,\n version: \"v1.0.2\",\n });\n case \"LightAccountV1.1.0\":\n return createLightAccount({\n ...commonParams,\n signer,\n version: \"v1.1.0\",\n });\n case \"MAv1.0.0-MultiOwner\":\n return createMultiOwnerModularAccount({\n ...commonParams,\n signer,\n });\n case \"LightAccountV2.0.0-MultiOwner\":\n return createMultiOwnerLightAccount({\n ...commonParams,\n version: \"v2.0.0\",\n signer,\n });\n case \"MAv1.0.0-MultiSig\":\n case \"MAv2.0.0-ma-ssv\":\n case \"unknown\":\n case undefined:\n throw new InvalidRequestError({\n message: `Account type currently unsupported: ${factoryType}`,\n });\n default:\n return assertNever(factoryType, \"Unsupported factory type\");\n }\n}\n\nconst MAV2_7702_DELEGATION_ADDRESS =\n \"0x69007702764179f14F51cdce752f4f775d74E139\";\n"]}
|
package/dist/esm/utils.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { type Hex } from "viem";
|
|
2
|
-
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
3
|
-
import type { WebAuthnPublicKey } from "@alchemy/wallet-api-types";
|
|
4
|
-
import type { ToWebAuthnAccountParameters } from "viem/account-abstraction";
|
|
5
|
-
import type { WebAuthnSigner } from "./client";
|
|
6
2
|
export type Expect<T extends true> = T;
|
|
7
3
|
export declare const assertNever: (_val: never, msg: string) => never;
|
|
8
4
|
/**
|
|
@@ -19,5 +15,3 @@ export declare const assertNever: (_val: never, msg: string) => never;
|
|
|
19
15
|
* ```
|
|
20
16
|
*/
|
|
21
17
|
export declare const castToHex: (val: string | number | bigint | Hex) => Hex;
|
|
22
|
-
export declare function isWebAuthnSigner(signer: SmartAccountSigner | WebAuthnSigner): signer is WebAuthnSigner;
|
|
23
|
-
export declare function credentialToWebAuthnPublicKey(credential: ToWebAuthnAccountParameters["credential"]): WebAuthnPublicKey;
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isHex,
|
|
1
|
+
import { isHex, toHex } from "viem";
|
|
2
2
|
export const assertNever = (_val, msg) => {
|
|
3
3
|
throw new Error(msg);
|
|
4
4
|
};
|
|
@@ -21,17 +21,4 @@ export const castToHex = (val) => {
|
|
|
21
21
|
}
|
|
22
22
|
return toHex(val);
|
|
23
23
|
};
|
|
24
|
-
export function isWebAuthnSigner(signer) {
|
|
25
|
-
return "credential" in signer;
|
|
26
|
-
}
|
|
27
|
-
export function credentialToWebAuthnPublicKey(credential) {
|
|
28
|
-
const { x, y } = {
|
|
29
|
-
x: sliceHex(credential.publicKey, 0, 32, { strict: true }),
|
|
30
|
-
y: sliceHex(credential.publicKey, 32, 64, { strict: true }),
|
|
31
|
-
};
|
|
32
|
-
return {
|
|
33
|
-
x,
|
|
34
|
-
y,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
24
|
//# sourceMappingURL=utils.js.map
|
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,
|
|
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;;;;;;;;;;;;GAYG;AACH,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/**\n * If the value is already Hex, it is returned unchanged. If it's a string, number or bigint, it's converted.\n *\n * @param {string | number | bigint | Hex} val - The value to convert to Hex.\n * @returns {Hex} The Hex value.\n *\n * @example\n * ```ts\n * const hex = castToHex(\"0x1234\");\n * const hex2 = castToHex(1234);\n * const hex3 = castToHex(BigInt(1234));\n * ```\n */\nexport const castToHex = (val: string | number | bigint | Hex): Hex => {\n if (isHex(val)) {\n return val;\n }\n return toHex(val);\n};\n"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.84.
|
|
1
|
+
export declare const VERSION = "4.84.1";
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.84.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.84.1\";\n"]}
|
|
@@ -20,7 +20,7 @@ export type GrantPermissionsResult = {
|
|
|
20
20
|
* This allows another key to perform operations on behalf of the account.
|
|
21
21
|
*
|
|
22
22
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
23
|
-
* @param {SmartAccountSigner
|
|
23
|
+
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
24
24
|
* @param {GrantPermissionsParams} params - The parameters for granting permissions
|
|
25
25
|
* @param {Address} [params.account] - The account address (required if client was not initialized with an account)
|
|
26
26
|
* @param {number} params.expirySec - Unix timestamp when the permissions expire
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grantPermissions.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/grantPermissions.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,QAAQ,EAGd,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAG/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"grantPermissions.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/grantPermissions.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,QAAQ,EAGd,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAG/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,KAAK,SAAS,GAAG,OAAO,CACtB,yBAAyB,EACzB;IACE,OAAO,EAAE;QACP,MAAM,EAAE,sBAAsB,CAAC;KAChC,CAAC;CACH,CACF,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,QAAQ,CACV,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC,GAC5D,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAC/B;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GACpB;IAAE,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAC3B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,sBAAsB,CAAC,QAAQ,CAAC,GACvC,OAAO,CAAC,sBAAsB,CAAC,CAkDjC"}
|
|
@@ -2,26 +2,22 @@ import type { WalletServerRpcSchemaType } from "@alchemy/wallet-api-types/rpc";
|
|
|
2
2
|
import type { InnerWalletApiClient } from "../../types.ts";
|
|
3
3
|
import type { Address } from "viem";
|
|
4
4
|
import type { SmartWalletSigner } from "../index.js";
|
|
5
|
-
import type { WebAuthnPublicKey } from "@alchemy/wallet-api-types";
|
|
6
5
|
type RpcSchema = Extract<WalletServerRpcSchemaType, {
|
|
7
6
|
Request: {
|
|
8
7
|
method: "wallet_listAccounts";
|
|
9
8
|
};
|
|
10
9
|
}>;
|
|
11
|
-
export type ListAccountsParams = Omit<RpcSchema["Request"]["params"][0], "signerAddress" | "signerPublicKey"> &
|
|
12
|
-
signerAddress
|
|
13
|
-
}
|
|
14
|
-
signerPublicKey: WebAuthnPublicKey;
|
|
15
|
-
} | {});
|
|
10
|
+
export type ListAccountsParams = Omit<RpcSchema["Request"]["params"][0], "signerAddress" | "signerPublicKey"> & {
|
|
11
|
+
signerAddress?: Address;
|
|
12
|
+
};
|
|
16
13
|
export type ListAccountsResult = RpcSchema["ReturnType"];
|
|
17
14
|
/**
|
|
18
15
|
* Lists all smart accounts for a given signer using the wallet API client.
|
|
19
16
|
*
|
|
20
17
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
21
|
-
* @param {SmartAccountSigner
|
|
18
|
+
* @param {SmartAccountSigner} signer - The signer for which to list accounts
|
|
22
19
|
* @param {ListAccountsParams} params - Parameters for listing accounts
|
|
23
20
|
* @param {Address} [params.signerAddress] - The address of the signer to list accounts for
|
|
24
|
-
* @param {WebAuthnPublicKey} [params.signerPublicKey] - The public key of the signer to list accounts for
|
|
25
21
|
* @param {number} [params.limit] - Optional maximum number of accounts to return (default: 100, max: 100)
|
|
26
22
|
* @param {string} [params.after] - Optional pagination cursor for fetching subsequent pages
|
|
27
23
|
* @returns {Promise<ListAccountsResult>} A Promise that resolves to the list of accounts and pagination metadata
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listAccounts.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/listAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"listAccounts.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/listAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,KAAK,SAAS,GAAG,OAAO,CACtB,yBAAyB,EACzB;IACE,OAAO,EAAE;QACP,MAAM,EAAE,qBAAqB,CAAC;KAC/B,CAAC;CACH,CACF,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EACjC,eAAe,GAAG,iBAAiB,CACpC,GAAG;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhC,MAAM,MAAM,kBAAkB,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,CAAC,CAkB7B"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SmartContractAccount } from "@aa-sdk/core";
|
|
2
2
|
import type { Address } from "abitype";
|
|
3
3
|
import type { WalletServerRpcSchemaType } from "@alchemy/wallet-api-types/rpc";
|
|
4
4
|
import type { InnerWalletApiClient } from "../../types.js";
|
|
5
5
|
import type { SmartWalletSigner } from "../index.js";
|
|
6
|
-
import type { WebAuthnPublicKey } from "@alchemy/wallet-api-types";
|
|
7
6
|
type RpcSchema = Extract<WalletServerRpcSchemaType, {
|
|
8
7
|
Request: {
|
|
9
8
|
method: "wallet_requestAccount";
|
|
@@ -11,9 +10,7 @@ type RpcSchema = Extract<WalletServerRpcSchemaType, {
|
|
|
11
10
|
}>;
|
|
12
11
|
export type RequestAccountParams = Omit<Extract<RpcSchema["Request"]["params"][0], {
|
|
13
12
|
signerAddress: Address;
|
|
14
|
-
} | {
|
|
15
|
-
signerPublicKey: WebAuthnPublicKey;
|
|
16
|
-
}>, "signerAddress" | "signerPublicKey" | "includeCounterfactualInfo"> & {
|
|
13
|
+
}>, "signerAddress" | "includeCounterfactualInfo"> & {
|
|
17
14
|
accountAddress?: Address;
|
|
18
15
|
};
|
|
19
16
|
export type RequestAccountResult = SmartContractAccount;
|
|
@@ -23,7 +20,7 @@ export type RequestAccountResult = SmartContractAccount;
|
|
|
23
20
|
* If an account already exists, the creationHint will be ignored.
|
|
24
21
|
*
|
|
25
22
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
26
|
-
* @param {SmartAccountSigner
|
|
23
|
+
* @param {SmartAccountSigner} signer - The signer that will be associated with the account
|
|
27
24
|
* @param {RequestAccountParams} [params] - Optional parameters for requesting a specific account
|
|
28
25
|
* @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
|
|
29
26
|
* @param {object} [params.creationHint] - Optional hints to guide account creation. These are ignored if an account already exists
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/requestAccount.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"requestAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/requestAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,KAAK,SAAS,GAAG,OAAO,CACtB,yBAAyB,EACzB;IACE,OAAO,EAAE;QACP,MAAM,EAAE,uBAAuB,CAAC;KACjC,CAAC;CACH,CACF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CAAC,EACtE,eAAe,GAAG,2BAA2B,CAC9C,GAAG;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjC,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAExD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,iBAAiB,EACzB,MAAM,CAAC,EAAE,oBAAoB,GAC5B,OAAO,CAAC,oBAAoB,CAAC,CAiD/B"}
|
|
@@ -14,7 +14,7 @@ export type SendCallsResult = SendPreparedCallsResult;
|
|
|
14
14
|
* </Note>
|
|
15
15
|
*
|
|
16
16
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
17
|
-
* @param {SmartAccountSigner
|
|
17
|
+
* @param {SmartAccountSigner} signer - The signer to use
|
|
18
18
|
* @param {PrepareCallsParams<TAccount>} params - Parameters for sending calls
|
|
19
19
|
* @param {Array<{to: Address, data?: Hex, value?: Hex}>} params.calls - Array of contract calls to execute
|
|
20
20
|
* @param {Address} [params.from] - The address to execute the calls from (required if the client wasn't initialized with an account)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/sendCalls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG1E,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"sendCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/sendCalls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG1E,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,eAAe,CACzB,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AAEjC,MAAM,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,GAChC,OAAO,CAAC,eAAe,CAAC,CA+B1B"}
|
|
@@ -11,7 +11,7 @@ export type SignMessageResult = Hex;
|
|
|
11
11
|
* This method requests the account associated with the signer and uses it to sign the message.
|
|
12
12
|
*
|
|
13
13
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
14
|
-
* @param {SmartAccountSigner
|
|
14
|
+
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
15
15
|
* @param {SignMessageParams} params - Parameters for signing the message
|
|
16
16
|
* @param {SignableMessage} params.message - The message to sign using EIP-191. Can be a string, or object with raw bytes.
|
|
17
17
|
* @param {Address} [params.account] - Optional account address to use for signing. If not provided, uses the client's current account.
|
|
@@ -11,7 +11,7 @@ export type SignPreparedCallsResult = RpcSchema["Request"]["params"][0];
|
|
|
11
11
|
/**
|
|
12
12
|
* Signs prepared calls using the provided signer.
|
|
13
13
|
*
|
|
14
|
-
* @param {SmartAccountSigner
|
|
14
|
+
* @param {SmartAccountSigner} signer - The signer to use
|
|
15
15
|
* @param {SignPreparedCallsParams} params - The prepared calls with signature requests
|
|
16
16
|
* @returns {Promise<SignPreparedCallsResult>} A Promise that resolves to the signed calls
|
|
17
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signPreparedCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAQ/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,KAAK,SAAS,GAAG,OAAO,CACtB,yBAAyB,EACzB;IACE,OAAO,EAAE;QACP,MAAM,EAAE,0BAA0B,CAAC;KACpC,CAAC;CACH,CACF,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AAEzD,MAAM,MAAM,uBAAuB,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAExE;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC,
|
|
1
|
+
{"version":3,"file":"signPreparedCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAQ/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,KAAK,SAAS,GAAG,OAAO,CACtB,yBAAyB,EACzB;IACE,OAAO,EAAE;QACP,MAAM,EAAE,0BAA0B,CAAC;KACpC,CAAC;CACH,CACF,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AAEzD,MAAM,MAAM,uBAAuB,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAExE;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC,CAmElC"}
|
|
@@ -1,14 +1,39 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { PersonalSignSignatureRequest, TypedDataSignatureRequest, AuthorizationSignatureRequest, Eip7702UnsignedAuth, UserOpSig, EcdsaSig, WebauthnSig } from "@alchemy/wallet-api-types";
|
|
1
|
+
import type { PersonalSignSignatureRequest, TypedDataSignatureRequest, AuthorizationSignatureRequest, Eip7702UnsignedAuth, EcdsaSig } from "@alchemy/wallet-api-types";
|
|
3
2
|
import type { WithoutRawPayload } from "../../types.ts";
|
|
4
|
-
import type {
|
|
3
|
+
import type { SmartWalletSigner } from "../index.js";
|
|
5
4
|
export type SignSignatureRequestParams = WithoutRawPayload<PersonalSignSignatureRequest | TypedDataSignatureRequest | (AuthorizationSignatureRequest & {
|
|
6
5
|
data: Eip7702UnsignedAuth;
|
|
7
6
|
})>;
|
|
8
|
-
export type SignSignatureRequestResult =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
export type SignSignatureRequestResult = EcdsaSig["signature"];
|
|
8
|
+
/**
|
|
9
|
+
* Signs a signature request using the provided signer.
|
|
10
|
+
* This method handles different types of signature requests including personal_sign, eth_signTypedData_v4, and authorization.
|
|
11
|
+
*
|
|
12
|
+
* @param {SmartAccountSigner} signer - The signer to use for signing the request
|
|
13
|
+
* @param {SignSignatureRequestParams} params - The signature request parameters
|
|
14
|
+
* @param {string} params.type - The type of signature request ('personal_sign', 'eth_signTypedData_v4', or 'signature_with_authorization')
|
|
15
|
+
* @param {SignSignatureRequestParams["data"]} params.data - The data to sign, format depends on the signature type
|
|
16
|
+
* @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Sign a personal message
|
|
21
|
+
* const result = await client.signSignatureRequest({
|
|
22
|
+
* type: 'personal_sign',
|
|
23
|
+
* data: 'Hello, world!'
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Sign typed data (EIP-712)
|
|
27
|
+
* const result = await client.signSignatureRequest({
|
|
28
|
+
* type: 'eth_signTypedData_v4',
|
|
29
|
+
* data: {
|
|
30
|
+
* domain: { ... },
|
|
31
|
+
* types: { ... },
|
|
32
|
+
* primaryType: '...',
|
|
33
|
+
* message: { ... }
|
|
34
|
+
* }
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function signSignatureRequest(signer: SmartWalletSigner, params: SignSignatureRequestParams): Promise<EcdsaSig["signature"]>;
|
|
14
39
|
//# sourceMappingURL=signSignatureRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signSignatureRequest.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signSignatureRequest.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,6BAA6B,EAC7B,mBAAmB,EACnB,QAAQ,EACT,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,CACtD,4BAA4B,GAC5B,yBAAyB,GACzB,CAAC,6BAA6B,GAAG;IAC/B,IAAI,EAAE,mBAAmB,CAAC;CAC3B,CAAC,CACL,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,0BAA0B,GACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAkDhC"}
|
|
@@ -10,7 +10,7 @@ export type SignTypedDataResult = Hex;
|
|
|
10
10
|
* This method requests the account associated with the signer and uses it to sign the typed data.
|
|
11
11
|
*
|
|
12
12
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
13
|
-
* @param {SmartAccountSigner
|
|
13
|
+
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
14
14
|
* @param {TypedDataDefinition} params - The typed data to sign, following EIP-712 format
|
|
15
15
|
* @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string
|
|
16
16
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EACV,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC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