@account-kit/wallet-client 0.1.0-alpha.9 → 4.50.0
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/LICENSE +21 -0
- package/dist/esm/client/actions/formatSign.d.ts +30 -0
- package/dist/esm/client/actions/formatSign.js +32 -0
- package/dist/esm/client/actions/formatSign.js.map +1 -0
- package/dist/esm/client/actions/getCallsStatus.d.ts +6 -3
- package/dist/esm/client/actions/getCallsStatus.js +3 -0
- package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/client/actions/grantPermissions.d.ts +10 -11
- package/dist/esm/client/actions/grantPermissions.js +26 -12
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/listAccounts.d.ts +10 -3
- package/dist/esm/client/actions/listAccounts.js +14 -2
- package/dist/esm/client/actions/listAccounts.js.map +1 -1
- package/dist/esm/client/actions/prepareCalls.d.ts +6 -3
- package/dist/esm/client/actions/prepareCalls.js +12 -8
- package/dist/esm/client/actions/prepareCalls.js.map +1 -1
- package/dist/esm/client/actions/prepareSign.d.ts +28 -0
- package/dist/esm/client/actions/prepareSign.js +31 -0
- package/dist/esm/client/actions/prepareSign.js.map +1 -0
- package/dist/esm/client/actions/requestAccount.d.ts +3 -1
- package/dist/esm/client/actions/requestAccount.js +5 -3
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/sendPreparedCalls.d.ts +3 -1
- package/dist/esm/client/actions/sendPreparedCalls.js +2 -0
- package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signMessage.d.ts +5 -2
- package/dist/esm/client/actions/signMessage.js +5 -2
- package/dist/esm/client/actions/signMessage.js.map +1 -1
- package/dist/esm/client/actions/signPreparedCalls.d.ts +2 -2
- package/dist/esm/client/actions/signPreparedCalls.js +3 -3
- package/dist/esm/client/actions/signPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signSignatureRequest.d.ts +6 -10
- package/dist/esm/client/actions/signSignatureRequest.js +4 -7
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/actions/signTypedData.d.ts +2 -0
- package/dist/esm/client/actions/signTypedData.js +2 -0
- package/dist/esm/client/actions/signTypedData.js.map +1 -1
- package/dist/esm/client/decorator.d.ts +0 -2
- package/dist/esm/client/decorator.js +1 -3
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/client/index.d.ts +10 -6
- package/dist/esm/client/index.js +18 -21
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/exports/index.d.ts +1 -5
- package/dist/esm/exports/index.js +1 -6
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/internal/account.d.ts +33 -0
- package/dist/esm/{isomorphic/utils/createAccount.js → internal/account.js} +25 -49
- package/dist/esm/internal/account.js.map +1 -0
- package/dist/esm/types.d.ts +5 -11
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils.d.ts +13 -1
- package/dist/esm/utils.js +13 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/version.d.ts +1 -0
- package/dist/esm/version.js +4 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/types/client/actions/formatSign.d.ts +31 -0
- package/dist/types/client/actions/formatSign.d.ts.map +1 -0
- package/dist/types/client/actions/getCallsStatus.d.ts +6 -3
- package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +10 -11
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/listAccounts.d.ts +10 -3
- package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
- package/dist/types/client/actions/prepareCalls.d.ts +6 -3
- package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/client/actions/prepareSign.d.ts +29 -0
- package/dist/types/client/actions/prepareSign.d.ts.map +1 -0
- package/dist/types/client/actions/requestAccount.d.ts +3 -1
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts +3 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signMessage.d.ts +5 -2
- package/dist/types/client/actions/signMessage.d.ts.map +1 -1
- package/dist/types/client/actions/signPreparedCalls.d.ts +2 -2
- package/dist/types/client/actions/signPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts +6 -10
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/actions/signTypedData.d.ts +2 -0
- package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/client/decorator.d.ts +0 -2
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +10 -6
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +1 -5
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/internal/account.d.ts +34 -0
- package/dist/types/internal/account.d.ts.map +1 -0
- package/dist/types/types.d.ts +5 -11
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +13 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/version.d.ts +2 -0
- package/dist/types/version.d.ts.map +1 -0
- package/package.json +33 -28
- package/src/client/actions/formatSign.ts +55 -0
- package/src/client/actions/getCallsStatus.ts +10 -6
- package/src/client/actions/grantPermissions.ts +46 -18
- package/src/client/actions/listAccounts.ts +22 -5
- package/src/client/actions/prepareCalls.ts +22 -16
- package/src/client/actions/prepareSign.ts +51 -0
- package/src/client/actions/requestAccount.ts +6 -4
- package/src/client/actions/sendPreparedCalls.ts +3 -1
- package/src/client/actions/signMessage.ts +5 -2
- package/src/client/actions/signPreparedCalls.ts +8 -12
- package/src/client/actions/signSignatureRequest.ts +12 -15
- package/src/client/actions/signTypedData.ts +2 -0
- package/src/client/decorator.ts +1 -8
- package/src/client/index.ts +41 -33
- package/src/exports/index.ts +1 -13
- package/src/internal/account.ts +120 -0
- package/src/types.ts +7 -18
- package/src/utils.ts +13 -1
- package/src/version.ts +3 -0
- package/dist/esm/capabilities/eip7702Auth.d.ts +0 -4
- package/dist/esm/capabilities/eip7702Auth.js +0 -18
- package/dist/esm/capabilities/eip7702Auth.js.map +0 -1
- package/dist/esm/capabilities/index.d.ts +0 -41
- package/dist/esm/capabilities/index.js +0 -14
- package/dist/esm/capabilities/index.js.map +0 -1
- package/dist/esm/capabilities/multiDimensionalNonce.d.ts +0 -3
- package/dist/esm/capabilities/multiDimensionalNonce.js +0 -7
- package/dist/esm/capabilities/multiDimensionalNonce.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 -145
- package/dist/esm/capabilities/permissions/index.js +0 -83
- 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 -88
- package/dist/esm/capabilities/permissions/mav2.js.map +0 -1
- package/dist/esm/client/actions/createAccount.d.ts +0 -35
- package/dist/esm/client/actions/createAccount.js +0 -32
- package/dist/esm/client/actions/createAccount.js.map +0 -1
- package/dist/esm/client/client.e2e-test.d.ts +0 -1
- package/dist/esm/client/client.e2e-test.js +0 -375
- package/dist/esm/client/client.e2e-test.js.map +0 -1
- package/dist/esm/exports/internal.d.ts +0 -14
- package/dist/esm/exports/internal.js +0 -16
- package/dist/esm/exports/internal.js.map +0 -1
- package/dist/esm/isomorphic/actions/createSession.d.ts +0 -14
- package/dist/esm/isomorphic/actions/createSession.js +0 -95
- package/dist/esm/isomorphic/actions/createSession.js.map +0 -1
- package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +0 -21
- package/dist/esm/isomorphic/actions/getCallsStatus.js +0 -113
- package/dist/esm/isomorphic/actions/getCallsStatus.js.map +0 -1
- package/dist/esm/isomorphic/actions/prepareCalls.d.ts +0 -8
- package/dist/esm/isomorphic/actions/prepareCalls.js +0 -116
- package/dist/esm/isomorphic/actions/prepareCalls.js.map +0 -1
- package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +0 -8
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js +0 -157
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +0 -1
- package/dist/esm/isomorphic/client.d.ts +0 -239
- package/dist/esm/isomorphic/client.js +0 -37
- package/dist/esm/isomorphic/client.js.map +0 -1
- package/dist/esm/isomorphic/utils/7702.d.ts +0 -23
- package/dist/esm/isomorphic/utils/7702.js +0 -75
- package/dist/esm/isomorphic/utils/7702.js.map +0 -1
- package/dist/esm/isomorphic/utils/createAccount.d.ts +0 -24
- package/dist/esm/isomorphic/utils/createAccount.js.map +0 -1
- package/dist/esm/isomorphic/utils/createDummySigner.d.ts +0 -3
- package/dist/esm/isomorphic/utils/createDummySigner.js +0 -17
- package/dist/esm/isomorphic/utils/createDummySigner.js.map +0 -1
- package/dist/esm/isomorphic/utils/decodeSignature.d.ts +0 -3
- package/dist/esm/isomorphic/utils/decodeSignature.js +0 -13
- package/dist/esm/isomorphic/utils/decodeSignature.js.map +0 -1
- package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +0 -21
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js +0 -34
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +0 -1
- package/dist/esm/isomorphic/utils/supportsFeature.d.ts +0 -4
- package/dist/esm/isomorphic/utils/supportsFeature.js +0 -21
- package/dist/esm/isomorphic/utils/supportsFeature.js.map +0 -1
- package/dist/esm/local/client.d.ts +0 -3
- package/dist/esm/local/client.js +0 -97
- package/dist/esm/local/client.js.map +0 -1
- package/dist/esm/remote/client.d.ts +0 -9
- package/dist/esm/remote/client.js +0 -41
- package/dist/esm/remote/client.js.map +0 -1
- package/dist/esm/rpc/examples.d.ts +0 -230
- package/dist/esm/rpc/examples.js +0 -314
- package/dist/esm/rpc/examples.js.map +0 -1
- package/dist/esm/rpc/request.d.ts +0 -755
- package/dist/esm/rpc/request.js +0 -214
- package/dist/esm/rpc/request.js.map +0 -1
- package/dist/esm/rpc/schema.d.ts +0 -703
- package/dist/esm/rpc/schema.js +0 -5
- package/dist/esm/rpc/schema.js.map +0 -1
- package/dist/esm/schemas.d.ts +0 -712
- package/dist/esm/schemas.js +0 -463
- package/dist/esm/schemas.js.map +0 -1
- package/dist/types/capabilities/eip7702Auth.d.ts +0 -5
- package/dist/types/capabilities/eip7702Auth.d.ts.map +0 -1
- package/dist/types/capabilities/index.d.ts +0 -42
- package/dist/types/capabilities/index.d.ts.map +0 -1
- package/dist/types/capabilities/multiDimensionalNonce.d.ts +0 -4
- package/dist/types/capabilities/multiDimensionalNonce.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 -146
- 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/client/actions/createAccount.d.ts +0 -36
- package/dist/types/client/actions/createAccount.d.ts.map +0 -1
- package/dist/types/client/client.e2e-test.d.ts +0 -2
- package/dist/types/client/client.e2e-test.d.ts.map +0 -1
- package/dist/types/exports/internal.d.ts +0 -15
- package/dist/types/exports/internal.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/createSession.d.ts +0 -15
- package/dist/types/isomorphic/actions/createSession.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts +0 -22
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/prepareCalls.d.ts +0 -9
- package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +0 -9
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +0 -1
- package/dist/types/isomorphic/client.d.ts +0 -240
- package/dist/types/isomorphic/client.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/7702.d.ts +0 -24
- package/dist/types/isomorphic/utils/7702.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/createAccount.d.ts +0 -25
- package/dist/types/isomorphic/utils/createAccount.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/createDummySigner.d.ts +0 -4
- package/dist/types/isomorphic/utils/createDummySigner.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/decodeSignature.d.ts +0 -4
- package/dist/types/isomorphic/utils/decodeSignature.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +0 -22
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/supportsFeature.d.ts +0 -5
- package/dist/types/isomorphic/utils/supportsFeature.d.ts.map +0 -1
- package/dist/types/local/client.d.ts +0 -4
- package/dist/types/local/client.d.ts.map +0 -1
- package/dist/types/remote/client.d.ts +0 -10
- package/dist/types/remote/client.d.ts.map +0 -1
- package/dist/types/rpc/examples.d.ts +0 -231
- package/dist/types/rpc/examples.d.ts.map +0 -1
- package/dist/types/rpc/request.d.ts +0 -756
- package/dist/types/rpc/request.d.ts.map +0 -1
- package/dist/types/rpc/schema.d.ts +0 -704
- package/dist/types/rpc/schema.d.ts.map +0 -1
- package/dist/types/schemas.d.ts +0 -713
- package/dist/types/schemas.d.ts.map +0 -1
- package/src/capabilities/eip7702Auth.ts +0 -26
- package/src/capabilities/index.ts +0 -14
- package/src/capabilities/multiDimensionalNonce.ts +0 -7
- package/src/capabilities/overrides.ts +0 -35
- package/src/capabilities/paymaster.ts +0 -5
- package/src/capabilities/permissions/index.ts +0 -163
- package/src/capabilities/permissions/mav2.ts +0 -138
- package/src/client/actions/createAccount.ts +0 -53
- package/src/client/client.e2e-test.ts +0 -463
- package/src/exports/internal.ts +0 -17
- package/src/isomorphic/actions/createSession.ts +0 -159
- package/src/isomorphic/actions/getCallsStatus.ts +0 -170
- package/src/isomorphic/actions/prepareCalls.ts +0 -170
- package/src/isomorphic/actions/sendPreparedCalls.ts +0 -232
- package/src/isomorphic/client.ts +0 -94
- package/src/isomorphic/utils/7702.ts +0 -143
- package/src/isomorphic/utils/createAccount.ts +0 -170
- package/src/isomorphic/utils/createDummySigner.ts +0 -27
- package/src/isomorphic/utils/decodeSignature.ts +0 -18
- package/src/isomorphic/utils/parsePermissionsContext.ts +0 -49
- package/src/isomorphic/utils/supportsFeature.ts +0 -34
- package/src/local/client.ts +0 -136
- package/src/remote/client.ts +0 -67
- package/src/rpc/examples.ts +0 -342
- package/src/rpc/request.ts +0 -300
- package/src/rpc/schema.ts +0 -40
- package/src/schemas.ts +0 -657
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.e2e-test.js","sourceRoot":"","sources":["../../../src/client/client.e2e-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAgB,MAAM,MAAM,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,SAAS,GAAG,OAAO,CACvB,OAAO,CAAC,GAAG,CAAC,qBAAqB;QAC/B,CAAC,CAAC;YACE,MAAM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it/infra\";\nimport { describe, expect, it } from \"bun:test\";\nimport { createPublicClient, zeroAddress, type Address } from \"viem\";\nimport { createSmartWalletClient } from \"./index.js\";\n\ndescribe(\"Client E2E Tests\", () => {\n const transport = alchemy(\n process.env.ALCHEMY_PROXY_RPC_URL\n ? {\n rpcUrl: process.env.ALCHEMY_PROXY_RPC_URL,\n }\n : {\n apiKey: process.env.TEST_ALCHEMY_API_KEY!,\n },\n );\n describe(\"Local Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xbaca22d9b6846ec09a4da378ffa07e2f14ce7d65675d135911b6fd281416bb03\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"local\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0xa46944b7a39c35d931D514ACAc3ac77c226a81ff\"`,\n );\n });\n\n it(\"should successfully request account with different salt\", async () => {\n const account = await client.requestAccount({\n id: \"f4c1d956-24ef-4002-a141-2c9d6d92af1a\",\n creationHint: { salt: \"0x1\" },\n });\n\n expect(account.address).toMatchInlineSnapshot(\n `\"0xA692f0E5AfAD20F771443D89C635146C6A592f06\"`,\n );\n });\n\n it(\"should not cache account if different inputs provided\", async () => {\n const account = await client.requestAccount();\n const account2 = await client.requestAccount({\n id: \"52ab44be-b03e-47ed-ad65-43014ea5fbfc\",\n creationHint: { salt: \"0x2\" },\n });\n\n expect(account.address).not.toEqual(account2.address);\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage({ message });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message,\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign a message with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"f4c1d956-24ef-4002-a141-2c9d6d92af1a\",\n creationHint: { salt: \"0x1\" },\n });\n const message = \"hello world\";\n\n const signature = await client.signMessage({\n message,\n account: account.address,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message,\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"f4c1d956-24ef-4002-a141-2c9d6d92af1a\",\n creationHint: { salt: \"0x1\" },\n });\n\n const signature = await client.signTypedData({\n ...givenTypedData,\n account: account.address,\n });\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster using 7702\", async () => {\n const _signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0x49daf21e92c997093e9ffdf7e7ddbf8970e9eadc5d4847d0f690db25d5128e1f\",\n );\n\n const _client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"local\",\n signer: _signer,\n });\n\n const account = await _client.requestAccount({\n creationHint: {\n accountType: \"7702\",\n },\n });\n\n const preparedCalls = await _client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n const signedCalls = await _client.signPreparedCalls(preparedCalls);\n\n const result = await _client.sendPreparedCalls(signedCalls);\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedCalls = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n const signedCalls = await client.signPreparedCalls(preparedCalls);\n\n const result = await client.sendPreparedCalls(signedCalls);\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expirySec: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: \"root\" }],\n });\n\n const sessionKeyClient = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"local\",\n signer: sessionKey,\n });\n\n const preparedCalls = await sessionKeyClient.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signedCalls =\n await sessionKeyClient.signPreparedCalls(preparedCalls);\n\n const result = await sessionKeyClient.sendPreparedCalls({\n ...signedCalls,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n describe(\"Remote Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xd7b061ef04d29cf68b3c89356678eccec9988de8d5ed892c19461c4a9d65925d\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"remote\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x76E765e80FFAC96ac10Aa8908a8267A3B80d606D\"`,\n );\n });\n\n it(\"should successfully request account with different salt\", async () => {\n const account = await client.requestAccount({\n id: \"26b375e3-c94a-4e98-b6b7-5a97121aa583\",\n creationHint: { salt: \"0x1\" },\n });\n\n expect(account.address).toMatchInlineSnapshot(\n `\"0xdfdd407b9569D40BEFa503208753E59cAc9713fA\"`,\n );\n });\n\n it(\"should not cache account if different inputs provided\", async () => {\n const account = await client.requestAccount();\n const account2 = await client.requestAccount({\n id: \"2a3320b4-6ed2-4833-a488-5188e9bdd9d2\",\n creationHint: { salt: \"0x2\" },\n });\n\n expect(account.address).not.toEqual(account2.address);\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage({ message });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign a message with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"26b375e3-c94a-4e98-b6b7-5a97121aa583\",\n creationHint: { salt: \"0x1\" },\n });\n\n const message = \"hello world\";\n const signature = await client.signMessage({\n message,\n account: account.address,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"26b375e3-c94a-4e98-b6b7-5a97121aa583\",\n creationHint: { salt: \"0x1\" },\n });\n\n const signature = await client.signTypedData({\n ...givenTypedData,\n account: account.address,\n });\n\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedCalls = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n const signedCalls = await client.signPreparedCalls(preparedCalls);\n\n const result = await client.sendPreparedCalls(signedCalls);\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully send a UO with paymaster using 7702\", async () => {\n const _signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0x00d35c6d307b5cddeb70aeed96ee27a551fee58bf1a43858477e6c11f9172ba8\",\n );\n\n const _client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"remote\",\n signer: _signer,\n });\n\n const account = await _client.requestAccount({\n creationHint: {\n accountType: \"7702\",\n },\n });\n expect(account.address).toBe(await _signer.getAddress());\n\n const preparedCalls = await _client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n const signedCalls = await _client.signPreparedCalls(preparedCalls);\n\n const result = await _client.sendPreparedCalls(signedCalls);\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expirySec: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: \"root\" }],\n });\n\n const sessionKeyClient = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"remote\",\n signer: sessionKey,\n });\n\n const preparedCalls = await sessionKeyClient.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signedCalls =\n await sessionKeyClient.signPreparedCalls(preparedCalls);\n\n const result = await sessionKeyClient.sendPreparedCalls({\n ...signedCalls,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n const givenTypedData = {\n types: {\n Person: [\n { name: \"name\", type: \"string\" },\n { name: \"wallet\", type: \"address\" },\n ],\n Mail: [\n { name: \"from\", type: \"Person\" },\n { name: \"to\", type: \"Person\" },\n { name: \"contents\", type: \"string\" },\n ],\n },\n primaryType: \"Mail\" as const,\n domain: {\n name: \"Ether Mail\",\n version: \"1\",\n chainId: 1,\n verifyingContract:\n \"0xbbc68f94D29d52EE8D4994E54d6ED0fEAeb99C2c\" as Address,\n },\n message: {\n from: {\n name: \"Alice\",\n wallet: \"0xFC24e57486116026740634F629ffC4E5C95A6893\",\n },\n to: {\n name: \"Bob\",\n wallet: \"0xe7a26f006EAA562308C5df235C02BFB9a5849177\",\n },\n contents: \"Hello, Bob!\",\n },\n } as const;\n});\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export * from "../capabilities/index.js";
|
|
2
|
-
export * from "../capabilities/paymaster.js";
|
|
3
|
-
export * from "../capabilities/permissions/index.js";
|
|
4
|
-
export * from "../capabilities/permissions/mav2.js";
|
|
5
|
-
export type * from "../isomorphic/client.js";
|
|
6
|
-
export { createIsomorphicClient } from "../isomorphic/client.js";
|
|
7
|
-
export { createDummySigner } from "../isomorphic/utils/createDummySigner.js";
|
|
8
|
-
export { prepareInitialOwners } from "../isomorphic/utils/createAccount.js";
|
|
9
|
-
export * from "../rpc/request.js";
|
|
10
|
-
export * as RpcSchemas from "../rpc/request.js";
|
|
11
|
-
export * from "../rpc/schema.js";
|
|
12
|
-
export * from "../schemas.js";
|
|
13
|
-
export type * from "../types.ts";
|
|
14
|
-
export * from "../utils.js";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// exports from this file are meant to be imported by our packages in the monorepo
|
|
2
|
-
// we will expose this in the package.json as a named export like `this-pkg/internal`
|
|
3
|
-
// TODO: name `this-pkg`
|
|
4
|
-
export * from "../capabilities/index.js";
|
|
5
|
-
export * from "../capabilities/paymaster.js";
|
|
6
|
-
export * from "../capabilities/permissions/index.js";
|
|
7
|
-
export * from "../capabilities/permissions/mav2.js";
|
|
8
|
-
export { createIsomorphicClient } from "../isomorphic/client.js";
|
|
9
|
-
export { createDummySigner } from "../isomorphic/utils/createDummySigner.js";
|
|
10
|
-
export { prepareInitialOwners } from "../isomorphic/utils/createAccount.js";
|
|
11
|
-
export * from "../rpc/request.js";
|
|
12
|
-
export * as RpcSchemas from "../rpc/request.js";
|
|
13
|
-
export * from "../rpc/schema.js";
|
|
14
|
-
export * from "../schemas.js";
|
|
15
|
-
export * from "../utils.js";
|
|
16
|
-
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/exports/internal.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,qFAAqF;AACrF,wBAAwB;AACxB,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AAEpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,cAAc,mBAAmB,CAAC;AAClC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAE9B,cAAc,aAAa,CAAC","sourcesContent":["// exports from this file are meant to be imported by our packages in the monorepo\n// we will expose this in the package.json as a named export like `this-pkg/internal`\n// TODO: name `this-pkg`\nexport * from \"../capabilities/index.js\";\nexport * from \"../capabilities/paymaster.js\";\nexport * from \"../capabilities/permissions/index.js\";\nexport * from \"../capabilities/permissions/mav2.js\";\nexport type * from \"../isomorphic/client.js\";\nexport { createIsomorphicClient } from \"../isomorphic/client.js\";\nexport { createDummySigner } from \"../isomorphic/utils/createDummySigner.js\";\nexport { prepareInitialOwners } from \"../isomorphic/utils/createAccount.js\";\nexport * from \"../rpc/request.js\";\nexport * as RpcSchemas from \"../rpc/request.js\";\nexport * from \"../rpc/schema.js\";\nexport * from \"../schemas.js\";\nexport type * from \"../types.ts\";\nexport * from \"../utils.js\";\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
|
-
import type { Static } from "@sinclair/typebox";
|
|
3
|
-
import { type Chain, type Hex, type Transport } from "viem";
|
|
4
|
-
import type { wallet_createSession } from "../../rpc/request.js";
|
|
5
|
-
import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
|
|
6
|
-
export type CreateSessionParams = Omit<Static<(typeof wallet_createSession)["properties"]["Request"]["properties"]["params"]>[0], "chainId"> & {
|
|
7
|
-
entityId?: Hex;
|
|
8
|
-
};
|
|
9
|
-
export type CreateSessionResult = Omit<Static<(typeof wallet_createSession)["properties"]["ReturnType"]>, "sessionId"> & {
|
|
10
|
-
sessionId: Hex | null;
|
|
11
|
-
entityId: Hex;
|
|
12
|
-
fullPreSignatureDeferredActionDigest: Hex;
|
|
13
|
-
};
|
|
14
|
-
export declare function createSession(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: CreateSessionParams): Promise<CreateSessionResult>;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { createSmartAccountClient, } from "@aa-sdk/core";
|
|
2
|
-
import { deferralActions, PermissionBuilder, } from "@account-kit/smart-contracts/experimental";
|
|
3
|
-
import { Value } from "@sinclair/typebox/value";
|
|
4
|
-
import { ChainNotFoundError, custom, hashTypedData, hexToNumber, toHex, } from "viem";
|
|
5
|
-
import { InvalidRequestError } from "ox/RpcResponse";
|
|
6
|
-
import { TypePermission } from "../../capabilities/permissions/index.js";
|
|
7
|
-
import { isGlobalValidation } from "../../capabilities/permissions/mav2.js";
|
|
8
|
-
import { createAccount, isModularAccountV2 } from "../utils/createAccount.js";
|
|
9
|
-
import { createDummySigner } from "../utils/createDummySigner.js";
|
|
10
|
-
import { supportsFeature } from "../utils/supportsFeature.js";
|
|
11
|
-
import { isDelegated } from "../utils/7702.js";
|
|
12
|
-
export async function createSession(client, params) {
|
|
13
|
-
if (!client.chain) {
|
|
14
|
-
throw new ChainNotFoundError();
|
|
15
|
-
}
|
|
16
|
-
const { counterfactualInfo, delegation } = await client.request({
|
|
17
|
-
method: "wallet_requestAccount",
|
|
18
|
-
params: [
|
|
19
|
-
{
|
|
20
|
-
accountAddress: params.account,
|
|
21
|
-
includeCounterfactualInfo: true,
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
});
|
|
25
|
-
if (delegation &&
|
|
26
|
-
!(await isDelegated(client, {
|
|
27
|
-
address: params.account,
|
|
28
|
-
delegation,
|
|
29
|
-
}))) {
|
|
30
|
-
throw new InvalidRequestError({
|
|
31
|
-
message: "7702 account must be delegated before calling `wallet_createSession`",
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
if (!delegation && !counterfactualInfo) {
|
|
35
|
-
throw new InvalidRequestError({
|
|
36
|
-
message: "No counterfactual info found.",
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
if (counterfactualInfo &&
|
|
40
|
-
!supportsFeature(counterfactualInfo, "permissions")) {
|
|
41
|
-
throw new InvalidRequestError({
|
|
42
|
-
message: "Account type does not support createSession",
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
// At this point we know the account supports the permission feature
|
|
46
|
-
const account = await createAccount({
|
|
47
|
-
chain: client.chain,
|
|
48
|
-
transport: custom(client.transport),
|
|
49
|
-
signer: createDummySigner(params.account),
|
|
50
|
-
accountAddress: params.account,
|
|
51
|
-
counterfactualInfo,
|
|
52
|
-
delegation,
|
|
53
|
-
});
|
|
54
|
-
if (!isModularAccountV2(account)) {
|
|
55
|
-
throw new InvalidRequestError({
|
|
56
|
-
message: "Sessions are currently only supported by MAv2 accounts.",
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
const _client = createSmartAccountClient({
|
|
60
|
-
chain: client.chain,
|
|
61
|
-
transport: custom(client.transport),
|
|
62
|
-
account,
|
|
63
|
-
}).extend(deferralActions);
|
|
64
|
-
const { entityId, nonce } = await _client.getEntityIdAndNonce({
|
|
65
|
-
entityId: params.entityId ? hexToNumber(params.entityId) : undefined,
|
|
66
|
-
isGlobalValidation: isGlobalValidation(params),
|
|
67
|
-
});
|
|
68
|
-
const { typedData, fullPreSignatureDeferredActionDigest } = await new PermissionBuilder({
|
|
69
|
-
client: _client,
|
|
70
|
-
key: {
|
|
71
|
-
...params.key,
|
|
72
|
-
// Alias 'ecdsa' to 'secp256k1'
|
|
73
|
-
type: params.key.type === "ecdsa" ? "secp256k1" : params.key.type,
|
|
74
|
-
},
|
|
75
|
-
entityId,
|
|
76
|
-
nonce,
|
|
77
|
-
deadline: params.expirySec,
|
|
78
|
-
})
|
|
79
|
-
.addPermissions({
|
|
80
|
-
permissions: params.permissions.map((permission) => Value.Encode(TypePermission, permission)),
|
|
81
|
-
})
|
|
82
|
-
.compileDeferred();
|
|
83
|
-
return {
|
|
84
|
-
sessionId: null, // In remote mode, the server will set this later.
|
|
85
|
-
chainId: toHex(client.chain.id),
|
|
86
|
-
entityId: toHex(entityId),
|
|
87
|
-
signatureRequest: {
|
|
88
|
-
type: "eth_signTypedData_v4",
|
|
89
|
-
data: typedData,
|
|
90
|
-
rawPayload: hashTypedData(typedData),
|
|
91
|
-
},
|
|
92
|
-
fullPreSignatureDeferredActionDigest,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=createSession.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,w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C,EAAE,GACvD,MAAM,IAAI,iBAAiB,CAAC;QAC1B,MAAM,EAAE,OAAO;QACf,GAAG,EAAE;YACH,GAAG,MAAM,CAAC,GAAG;YACb,+BAA+B;YAC/B,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI;SAClE;QACD,QAAQ;QACR,KAAK;QACL,QAAQ,EAAE,MAAM,CAAC,SAAS;KAC3B,CAAC;SACC,cAAc,CAAC;QACd,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CACjD,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,CACzC;KACF,CAAC;SACD,eAAe,EAAE,CAAC;IAEvB,OAAO;QACL,SAAS,EAAE,IAAI,EAAE,kDAAkD;QACnE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;QACzB,gBAAgB,EAAE;YAChB,IAAI,EAAE,sBAA+B;YACrC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC;SACrC;QACD,oCAAoC;KACrC,CAAC;AACJ,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport {\n deferralActions,\n PermissionBuilder,\n} from \"@account-kit/smart-contracts/experimental\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n ChainNotFoundError,\n custom,\n hashTypedData,\n hexToNumber,\n toHex,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { TypePermission } from \"../../capabilities/permissions/index.js\";\nimport { isGlobalValidation } from \"../../capabilities/permissions/mav2.js\";\nimport type { wallet_createSession } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { createAccount, isModularAccountV2 } from \"../utils/createAccount.js\";\nimport { createDummySigner } from \"../utils/createDummySigner.js\";\nimport { supportsFeature } from \"../utils/supportsFeature.js\";\nimport { isDelegated } from \"../utils/7702.js\";\n\nexport type CreateSessionParams = Omit<\n Static<\n (typeof wallet_createSession)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n> & {\n entityId?: Hex;\n};\n\nexport type CreateSessionResult = Omit<\n Static<(typeof wallet_createSession)[\"properties\"][\"ReturnType\"]>,\n \"sessionId\"\n> & {\n sessionId: Hex | null;\n entityId: Hex;\n fullPreSignatureDeferredActionDigest: Hex;\n};\n\nexport async function createSession(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: CreateSessionParams,\n): Promise<CreateSessionResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const { counterfactualInfo, delegation } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n {\n accountAddress: params.account,\n includeCounterfactualInfo: true,\n },\n ],\n });\n\n if (\n delegation &&\n !(await isDelegated(client, {\n address: params.account,\n delegation,\n }))\n ) {\n throw new InvalidRequestError({\n message:\n \"7702 account must be delegated before calling `wallet_createSession`\",\n });\n }\n\n if (!delegation && !counterfactualInfo) {\n throw new InvalidRequestError({\n message: \"No counterfactual info found.\",\n });\n }\n\n if (\n counterfactualInfo &&\n !supportsFeature(counterfactualInfo, \"permissions\")\n ) {\n throw new InvalidRequestError({\n message: \"Account type does not support createSession\",\n });\n }\n\n // At this point we know the account supports the permission feature\n const account = await createAccount({\n chain: client.chain,\n transport: custom(client.transport),\n signer: createDummySigner(params.account),\n accountAddress: params.account,\n counterfactualInfo,\n delegation,\n });\n\n if (!isModularAccountV2(account)) {\n throw new InvalidRequestError({\n message: \"Sessions are currently only supported by MAv2 accounts.\",\n });\n }\n\n const _client = createSmartAccountClient({\n chain: client.chain,\n transport: custom(client.transport),\n account,\n }).extend(deferralActions);\n\n const { entityId, nonce } = await _client.getEntityIdAndNonce({\n entityId: params.entityId ? hexToNumber(params.entityId) : undefined,\n isGlobalValidation: isGlobalValidation(params),\n });\n\n const { typedData, fullPreSignatureDeferredActionDigest } =\n await new PermissionBuilder({\n client: _client,\n key: {\n ...params.key,\n // Alias 'ecdsa' to 'secp256k1'\n type: params.key.type === \"ecdsa\" ? \"secp256k1\" : params.key.type,\n },\n entityId,\n nonce,\n deadline: params.expirySec,\n })\n .addPermissions({\n permissions: params.permissions.map((permission) =>\n Value.Encode(TypePermission, permission),\n ),\n })\n .compileDeferred();\n\n return {\n sessionId: null, // In remote mode, the server will set this later.\n chainId: toHex(client.chain.id),\n entityId: toHex(entityId),\n signatureRequest: {\n type: \"eth_signTypedData_v4\" as const,\n data: typedData,\n rawPayload: hashTypedData(typedData),\n },\n fullPreSignatureDeferredActionDigest,\n };\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
|
-
import type { Static } from "@sinclair/typebox";
|
|
3
|
-
import { type Chain, type Transport } from "viem";
|
|
4
|
-
import type { wallet_getCallsStatus } from "../../rpc/request.js";
|
|
5
|
-
import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
|
|
6
|
-
export type GetCallsStatusParams = Static<(typeof wallet_getCallsStatus)["properties"]["Request"]["properties"]["params"]>[0];
|
|
7
|
-
export type GetCallsStatusResponse = Static<(typeof wallet_getCallsStatus)["properties"]["ReturnType"]>;
|
|
8
|
-
/** EIP-5792 call status codes */
|
|
9
|
-
export declare const CallStatusCode: {
|
|
10
|
-
/** Batch has been received by the wallet but has not completed execution onchain */
|
|
11
|
-
readonly PENDING: 100;
|
|
12
|
-
/** Batch has been included onchain without reverts, receipts array contains info of all calls */
|
|
13
|
-
readonly CONFIRMED: 200;
|
|
14
|
-
/** Batch has not been included onchain and wallet will not retry */
|
|
15
|
-
readonly OFFCHAIN_FAILURE: 400;
|
|
16
|
-
/** Batch reverted *completely* and only changes related to gas charge may have been included onchain */
|
|
17
|
-
readonly CHAIN_RULES_FAILURE: 500;
|
|
18
|
-
/** Batch reverted *partially* and some changes related to batch calls may have been included onchain */
|
|
19
|
-
readonly PARTIAL_CHAIN_RULES_FAILURE: 600;
|
|
20
|
-
};
|
|
21
|
-
export declare function getCallsStatus(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, callId: GetCallsStatusParams): Promise<GetCallsStatusResponse>;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import {} from "@aa-sdk/core";
|
|
2
|
-
import { Value } from "@sinclair/typebox/value";
|
|
3
|
-
import { ChainNotFoundError, hexToNumber, isHex, } from "viem";
|
|
4
|
-
import { TypeCallId } from "../../schemas.js";
|
|
5
|
-
import { castToHex } from "../../utils.js";
|
|
6
|
-
import { InternalError, BaseError } from "ox/RpcResponse";
|
|
7
|
-
import { polygon, mainnet, base, worldchain, optimism, arbitrum, sepolia, polygonAmoy, baseSepolia, optimismSepolia, worldchainSepolia, arbitrumSepolia, } from "viem/chains";
|
|
8
|
-
const ReceiptStatus = {
|
|
9
|
-
reverted: "0x0",
|
|
10
|
-
success: "0x1",
|
|
11
|
-
};
|
|
12
|
-
/** EIP-5792 call status codes */
|
|
13
|
-
export const CallStatusCode = {
|
|
14
|
-
/** Batch has been received by the wallet but has not completed execution onchain */
|
|
15
|
-
PENDING: 100,
|
|
16
|
-
/** Batch has been included onchain without reverts, receipts array contains info of all calls */
|
|
17
|
-
CONFIRMED: 200,
|
|
18
|
-
/** Batch has not been included onchain and wallet will not retry */
|
|
19
|
-
OFFCHAIN_FAILURE: 400,
|
|
20
|
-
/** Batch reverted *completely* and only changes related to gas charge may have been included onchain */
|
|
21
|
-
CHAIN_RULES_FAILURE: 500,
|
|
22
|
-
/** Batch reverted *partially* and some changes related to batch calls may have been included onchain */
|
|
23
|
-
PARTIAL_CHAIN_RULES_FAILURE: 600,
|
|
24
|
-
};
|
|
25
|
-
// https://eips.ethereum.org/EIPS/eip-5792#error-codes
|
|
26
|
-
const ErrorCode = {
|
|
27
|
-
UNKNOWN_BUNDLE_ID: 5730,
|
|
28
|
-
};
|
|
29
|
-
// "eth_getUserOperationByHash" is limited to the last 150 blocks
|
|
30
|
-
// for all networks except those in this list.
|
|
31
|
-
// https://www.alchemy.com/docs/node/bundler-api/bundler-api-endpoints/eth-get-user-operation-by-hash
|
|
32
|
-
const GET_USER_OP_BY_HASH_UNLIMITED_RANGE_NETWORKS = [
|
|
33
|
-
mainnet.id,
|
|
34
|
-
sepolia.id,
|
|
35
|
-
polygon.id,
|
|
36
|
-
polygonAmoy.id,
|
|
37
|
-
base.id,
|
|
38
|
-
baseSepolia.id,
|
|
39
|
-
optimism.id,
|
|
40
|
-
optimismSepolia.id,
|
|
41
|
-
worldchain.id,
|
|
42
|
-
worldchainSepolia.id,
|
|
43
|
-
arbitrum.id,
|
|
44
|
-
arbitrumSepolia.id,
|
|
45
|
-
];
|
|
46
|
-
export async function getCallsStatus(client, callId) {
|
|
47
|
-
if (!client.chain) {
|
|
48
|
-
throw new ChainNotFoundError();
|
|
49
|
-
}
|
|
50
|
-
const { chainId, hash } = Value.Decode(TypeCallId, callId);
|
|
51
|
-
const baseResp = {
|
|
52
|
-
id: callId,
|
|
53
|
-
chainId,
|
|
54
|
-
atomic: true,
|
|
55
|
-
};
|
|
56
|
-
const result = await client.getUserOperationByHash(hash);
|
|
57
|
-
if (!result &&
|
|
58
|
-
GET_USER_OP_BY_HASH_UNLIMITED_RANGE_NETWORKS.includes(hexToNumber(chainId))) {
|
|
59
|
-
// This network has unlimited range, so we should always have a result here if the callId is valid.
|
|
60
|
-
throw new BaseError({
|
|
61
|
-
message: `callId ${callId} not found`,
|
|
62
|
-
code: ErrorCode.UNKNOWN_BUNDLE_ID,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
if (result && !result.transactionHash) {
|
|
66
|
-
// A result but no txn hash means it's valid but pending.
|
|
67
|
-
return {
|
|
68
|
-
...baseResp,
|
|
69
|
-
status: CallStatusCode.PENDING,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
const receipt = await client.getUserOperationReceipt(hash);
|
|
73
|
-
if (result?.transactionHash && !receipt) {
|
|
74
|
-
// This should never happen.
|
|
75
|
-
throw new InternalError({
|
|
76
|
-
message: `Failed to get receipt for callId ${callId}`,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
if (!receipt) {
|
|
80
|
-
// This covers txns older than 150 blocks which were not retrievable by "eth_getUserOperationByHash".
|
|
81
|
-
throw new BaseError({
|
|
82
|
-
message: `callId ${callId} not found`,
|
|
83
|
-
code: ErrorCode.UNKNOWN_BUNDLE_ID,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
return {
|
|
87
|
-
...baseResp,
|
|
88
|
-
status: receipt.success
|
|
89
|
-
? CallStatusCode.CONFIRMED
|
|
90
|
-
: CallStatusCode.CHAIN_RULES_FAILURE,
|
|
91
|
-
receipts: [transformReceipt(receipt.receipt)],
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
function transformReceipt(receipt) {
|
|
95
|
-
return {
|
|
96
|
-
// viem's type for status is "success" | "reverted", but the actual value seems to already be 0x0 or 0x1
|
|
97
|
-
status: isHex(receipt.status)
|
|
98
|
-
? receipt.status
|
|
99
|
-
: ReceiptStatus[receipt.status],
|
|
100
|
-
blockHash: receipt.blockHash,
|
|
101
|
-
// viem's type for blockNumber is bigint, but the actual value seems to already be a hex string
|
|
102
|
-
blockNumber: castToHex(receipt.blockNumber),
|
|
103
|
-
// viem's type for gasUsed is bigint, but the actual value seems to already be a hex string
|
|
104
|
-
gasUsed: castToHex(receipt.gasUsed),
|
|
105
|
-
transactionHash: receipt.transactionHash,
|
|
106
|
-
logs: receipt.logs.map((log) => ({
|
|
107
|
-
address: log.address,
|
|
108
|
-
data: log.data,
|
|
109
|
-
topics: log.topics,
|
|
110
|
-
})),
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
//# sourceMappingURL=getCallsStatus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCallsStatus.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/getCallsStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,KAAK,GAKN,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EACL,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,WAAW,EACX,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,eAAe,GAChB,MAAM,aAAa,CAAC;AAUrB,MAAM,aAAa,GAA8C;IAC/D,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;CACf,CAAC;AAEF,iCAAiC;AACjC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,oFAAoF;IACpF,OAAO,EAAE,GAAG;IACZ,iGAAiG;IACjG,SAAS,EAAE,GAAG;IACd,oEAAoE;IACpE,gBAAgB,EAAE,GAAG;IACrB,wGAAwG;IACxG,mBAAmB,EAAE,GAAG;IACxB,wGAAwG;IACxG,2BAA2B,EAAE,GAAG;CACxB,CAAC;AAEX,sDAAsD;AACtD,MAAM,SAAS,GAAG;IAChB,iBAAiB,EAAE,IAAI;CACxB,CAAC;AAEF,iEAAiE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AC,MAAM;SACnB,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC","sourcesContent":["import {\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n ChainNotFoundError,\n hexToNumber,\n isHex,\n type Chain,\n type Hex,\n type TransactionReceipt,\n type Transport,\n} from \"viem\";\nimport type { wallet_getCallsStatus } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { TypeCallId } from \"../../schemas.js\";\nimport { castToHex } from \"../../utils.js\";\nimport { InternalError, BaseError } from \"ox/RpcResponse\";\nimport {\n polygon,\n mainnet,\n base,\n worldchain,\n optimism,\n arbitrum,\n sepolia,\n polygonAmoy,\n baseSepolia,\n optimismSepolia,\n worldchainSepolia,\n arbitrumSepolia,\n} from \"viem/chains\";\n\nexport type GetCallsStatusParams = Static<\n (typeof wallet_getCallsStatus)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n>[0];\n\nexport type GetCallsStatusResponse = Static<\n (typeof wallet_getCallsStatus)[\"properties\"][\"ReturnType\"]\n>;\n\nconst ReceiptStatus: Record<TransactionReceipt[\"status\"], Hex> = {\n reverted: \"0x0\",\n success: \"0x1\",\n};\n\n/** EIP-5792 call status codes */\nexport const CallStatusCode = {\n /** Batch has been received by the wallet but has not completed execution onchain */\n PENDING: 100,\n /** Batch has been included onchain without reverts, receipts array contains info of all calls */\n CONFIRMED: 200,\n /** Batch has not been included onchain and wallet will not retry */\n OFFCHAIN_FAILURE: 400,\n /** Batch reverted *completely* and only changes related to gas charge may have been included onchain */\n CHAIN_RULES_FAILURE: 500,\n /** Batch reverted *partially* and some changes related to batch calls may have been included onchain */\n PARTIAL_CHAIN_RULES_FAILURE: 600,\n} as const;\n\n// https://eips.ethereum.org/EIPS/eip-5792#error-codes\nconst ErrorCode = {\n UNKNOWN_BUNDLE_ID: 5730,\n};\n\n// \"eth_getUserOperationByHash\" is limited to the last 150 blocks\n// for all networks except those in this list.\n// https://www.alchemy.com/docs/node/bundler-api/bundler-api-endpoints/eth-get-user-operation-by-hash\nconst GET_USER_OP_BY_HASH_UNLIMITED_RANGE_NETWORKS: number[] = [\n mainnet.id,\n sepolia.id,\n polygon.id,\n polygonAmoy.id,\n base.id,\n baseSepolia.id,\n optimism.id,\n optimismSepolia.id,\n worldchain.id,\n worldchainSepolia.id,\n arbitrum.id,\n arbitrumSepolia.id,\n];\n\nexport async function getCallsStatus(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n callId: GetCallsStatusParams,\n): Promise<GetCallsStatusResponse> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n const { chainId, hash } = Value.Decode(TypeCallId, callId);\n\n const baseResp = {\n id: callId,\n chainId,\n atomic: true,\n };\n\n const result = await client.getUserOperationByHash(hash);\n if (\n !result &&\n GET_USER_OP_BY_HASH_UNLIMITED_RANGE_NETWORKS.includes(hexToNumber(chainId))\n ) {\n // This network has unlimited range, so we should always have a result here if the callId is valid.\n throw new BaseError({\n message: `callId ${callId} not found`,\n code: ErrorCode.UNKNOWN_BUNDLE_ID,\n });\n }\n if (result && !result.transactionHash) {\n // A result but no txn hash means it's valid but pending.\n return {\n ...baseResp,\n status: CallStatusCode.PENDING,\n };\n }\n\n const receipt = await client.getUserOperationReceipt(hash);\n if (result?.transactionHash && !receipt) {\n // This should never happen.\n throw new InternalError({\n message: `Failed to get receipt for callId ${callId}`,\n });\n }\n if (!receipt) {\n // This covers txns older than 150 blocks which were not retrievable by \"eth_getUserOperationByHash\".\n throw new BaseError({\n message: `callId ${callId} not found`,\n code: ErrorCode.UNKNOWN_BUNDLE_ID,\n });\n }\n\n return {\n ...baseResp,\n status: receipt.success\n ? CallStatusCode.CONFIRMED\n : CallStatusCode.CHAIN_RULES_FAILURE,\n receipts: [transformReceipt(receipt.receipt)],\n };\n}\n\nfunction transformReceipt(\n receipt: TransactionReceipt,\n): NonNullable<GetCallsStatusResponse[\"receipts\"]>[number] {\n return {\n // viem's type for status is \"success\" | \"reverted\", but the actual value seems to already be 0x0 or 0x1\n status: isHex(receipt.status)\n ? receipt.status\n : ReceiptStatus[receipt.status],\n blockHash: receipt.blockHash,\n // viem's type for blockNumber is bigint, but the actual value seems to already be a hex string\n blockNumber: castToHex(receipt.blockNumber),\n // viem's type for gasUsed is bigint, but the actual value seems to already be a hex string\n gasUsed: castToHex(receipt.gasUsed),\n transactionHash: receipt.transactionHash,\n logs: receipt.logs.map((log) => ({\n address: log.address,\n data: log.data,\n topics: log.topics,\n })),\n };\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
|
-
import type { Static } from "@sinclair/typebox";
|
|
3
|
-
import { type Chain, type Transport } from "viem";
|
|
4
|
-
import type { wallet_prepareCalls } from "../../rpc/request.js";
|
|
5
|
-
import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
|
|
6
|
-
export type PrepareCallsParams = Omit<Static<(typeof wallet_prepareCalls)["properties"]["Request"]["properties"]["params"]>[0], "chainId">;
|
|
7
|
-
export type PrepareCallsResult = Static<(typeof wallet_prepareCalls)["properties"]["ReturnType"]>;
|
|
8
|
-
export declare function prepareCalls(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: PrepareCallsParams): Promise<PrepareCallsResult>;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { deepHexlify, default7702GasEstimator, } from "@aa-sdk/core";
|
|
2
|
-
import { ChainNotFoundError, custom, fromHex, hashMessage, toHex, } from "viem";
|
|
3
|
-
import { createAccount } from "../utils/createAccount.js";
|
|
4
|
-
import { createDummySigner } from "../utils/createDummySigner.js";
|
|
5
|
-
import { createAuthorizationRequest, isDelegated } from "../utils/7702.js";
|
|
6
|
-
import { InvalidRequestError } from "ox/RpcResponse";
|
|
7
|
-
import { assertNever } from "../../utils.js";
|
|
8
|
-
import { assertValid7702AccountAddress } from "../utils/7702.js";
|
|
9
|
-
export async function prepareCalls(client, params) {
|
|
10
|
-
if (!client.chain) {
|
|
11
|
-
throw new ChainNotFoundError();
|
|
12
|
-
}
|
|
13
|
-
assertValid7702AccountAddress(params.from, params.capabilities?.eip7702Auth);
|
|
14
|
-
// in local mode, we probably want some kind of caching for this
|
|
15
|
-
const { counterfactualInfo, delegation } = await client.request({
|
|
16
|
-
method: "wallet_requestAccount",
|
|
17
|
-
params: [
|
|
18
|
-
params.capabilities?.eip7702Auth
|
|
19
|
-
? {
|
|
20
|
-
signerAddress: params.from,
|
|
21
|
-
creationHint: {
|
|
22
|
-
accountType: "7702",
|
|
23
|
-
},
|
|
24
|
-
includeCounterfactualInfo: true,
|
|
25
|
-
}
|
|
26
|
-
: {
|
|
27
|
-
accountAddress: params.from,
|
|
28
|
-
includeCounterfactualInfo: true,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
});
|
|
32
|
-
if (!counterfactualInfo && !delegation) {
|
|
33
|
-
throw new InvalidRequestError({
|
|
34
|
-
message: "No counterfactual info or delegated implementation address found.",
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
const account = await createAccount({
|
|
38
|
-
chain: client.chain,
|
|
39
|
-
transport: custom(client.transport),
|
|
40
|
-
signer: createDummySigner(params.from),
|
|
41
|
-
accountAddress: params.from,
|
|
42
|
-
counterfactualInfo,
|
|
43
|
-
permissions: params.capabilities?.permissions,
|
|
44
|
-
delegation,
|
|
45
|
-
});
|
|
46
|
-
const authorizationRequest = delegation &&
|
|
47
|
-
!(await isDelegated(client, {
|
|
48
|
-
address: account.address,
|
|
49
|
-
delegation,
|
|
50
|
-
}))
|
|
51
|
-
? await createAuthorizationRequest(client, {
|
|
52
|
-
address: account.address,
|
|
53
|
-
delegation,
|
|
54
|
-
})
|
|
55
|
-
: undefined;
|
|
56
|
-
if (params.capabilities?.permissions && authorizationRequest) {
|
|
57
|
-
// The user shouldn't see this in most cases since we require
|
|
58
|
-
// the account to be delegated before creating the session.
|
|
59
|
-
throw new InvalidRequestError({
|
|
60
|
-
message: "When using a 7702 account with a session key, the account must be delegated before preparing calls.",
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
if (authorizationRequest) {
|
|
64
|
-
// @ts-expect-error - this is available but not typed as public
|
|
65
|
-
client.middleware.gasEstimator = default7702GasEstimator();
|
|
66
|
-
}
|
|
67
|
-
// TODO: oops we don't actually support setting the policyId as an override here
|
|
68
|
-
// if we assume that the the isomorphic client is never used directly, then we can assume that this is handled upstream correctly
|
|
69
|
-
const builtUo = await client.buildUserOperation({
|
|
70
|
-
uo: params.calls.map((x) => ({
|
|
71
|
-
target: x.to,
|
|
72
|
-
data: x.data ?? "0x",
|
|
73
|
-
value: x.value ? fromHex(x.value, "bigint") : undefined,
|
|
74
|
-
})),
|
|
75
|
-
account,
|
|
76
|
-
overrides: {
|
|
77
|
-
...params.capabilities?.gasParamsOverride,
|
|
78
|
-
nonceKey: params.capabilities?.nonceOverride?.nonceKey
|
|
79
|
-
? fromHex(params.capabilities.nonceOverride.nonceKey, "bigint")
|
|
80
|
-
: undefined,
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
// The eip7702Auth field should never be included in the UO sig
|
|
84
|
-
// request. It's handled by a separate authorization request.
|
|
85
|
-
if ("eip7702Auth" in builtUo) {
|
|
86
|
-
builtUo.eip7702Auth = undefined;
|
|
87
|
-
}
|
|
88
|
-
const hexlifiedUo = deepHexlify(builtUo);
|
|
89
|
-
const ep = account.getEntryPoint();
|
|
90
|
-
const uoHash = ep.getUserOperationHash(hexlifiedUo);
|
|
91
|
-
const uoRequest = {
|
|
92
|
-
type: ep.version === "0.7.0"
|
|
93
|
-
? "user-operation-v070"
|
|
94
|
-
: ep.version === "0.6.0"
|
|
95
|
-
? "user-operation-v060"
|
|
96
|
-
: assertNever(ep.version, "Unexpected entry point version"),
|
|
97
|
-
data: hexlifiedUo,
|
|
98
|
-
chainId: toHex(client.chain.id),
|
|
99
|
-
signatureRequest: {
|
|
100
|
-
type: "personal_sign",
|
|
101
|
-
data: {
|
|
102
|
-
raw: uoHash,
|
|
103
|
-
},
|
|
104
|
-
rawPayload: hashMessage({
|
|
105
|
-
raw: uoHash,
|
|
106
|
-
}),
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
return authorizationRequest
|
|
110
|
-
? {
|
|
111
|
-
type: "array",
|
|
112
|
-
data: [authorizationRequest, uoRequest],
|
|
113
|
-
}
|
|
114
|
-
: uoRequest;
|
|
115
|
-
}
|
|
116
|
-
//# sourceMappingURL=prepareCalls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,uBAAuB,GAGxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,OAAO,EACP,WAAW,EACX,KAAK,GAGN,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAajE,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAMC,EACD,MAA0B;IAE1B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,6BA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CAAC,aAAa,EAAE,CAAC;IAEnC,MAAM,MAAM,GAAG,EAAE,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAEpD,MAAM,SAAS,GAAG;QAChB,IAAI,EACF,EAAE,CAAC,OAAO,KAAK,OAAO;YACpB,CAAC,CAAE,qBAA+B;YAClC,CAAC,CAAC,EAAE,CAAC,OAAO,KAAK,OAAO;gBACtB,CAAC,CAAE,qBAA+B;gBAClC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,gCAAgC,CAAC;QACjE,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,gBAAgB,EAAE;YAChB,IAAI,EAAE,eAAwB;YAC9B,IAAI,EAAE;gBACJ,GAAG,EAAE,MAAM;aACZ;YACD,UAAU,EAAE,WAAW,CAAC;gBACtB,GAAG,EAAE,MAAM;aACZ,CAAC;SACH;KACF,CAAC;IAEF,OAAO,oBAAoB;QACzB,CAAC,CAAC;YACE,IAAI,EAAE,OAAgB;YACtB,IAAI,EAAE,CAAC,oBAAoB,EAAE,SAAS,CAAC;SACxC;QACH,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC","sourcesContent":["import {\n deepHexlify,\n default7702GasEstimator,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport {\n ChainNotFoundError,\n custom,\n fromHex,\n hashMessage,\n toHex,\n type Chain,\n type Transport,\n} from \"viem\";\nimport type { wallet_prepareCalls } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { createAccount } from \"../utils/createAccount.js\";\nimport { createDummySigner } from \"../utils/createDummySigner.js\";\nimport { createAuthorizationRequest, isDelegated } from \"../utils/7702.js\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { assertNever } from \"../../utils.js\";\nimport { assertValid7702AccountAddress } from \"../utils/7702.js\";\n\nexport type PrepareCallsParams = Omit<\n Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n>;\n\nexport type PrepareCallsResult = Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"ReturnType\"]\n>;\n\nexport async function prepareCalls(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: PrepareCallsParams,\n): Promise<PrepareCallsResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n assertValid7702AccountAddress(params.from, params.capabilities?.eip7702Auth);\n\n // in local mode, we probably want some kind of caching for this\n const { counterfactualInfo, delegation } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n params.capabilities?.eip7702Auth\n ? {\n signerAddress: params.from,\n creationHint: {\n accountType: \"7702\",\n },\n includeCounterfactualInfo: true,\n }\n : {\n accountAddress: params.from,\n includeCounterfactualInfo: true,\n },\n ],\n });\n\n if (!counterfactualInfo && !delegation) {\n throw new InvalidRequestError({\n message:\n \"No counterfactual info or delegated implementation address found.\",\n });\n }\n\n const account = await createAccount({\n chain: client.chain,\n transport: custom(client.transport),\n signer: createDummySigner(params.from),\n accountAddress: params.from,\n counterfactualInfo,\n permissions: params.capabilities?.permissions,\n delegation,\n });\n\n const authorizationRequest =\n delegation &&\n !(await isDelegated(client, {\n address: account.address,\n delegation,\n }))\n ? await createAuthorizationRequest(client, {\n address: account.address,\n delegation,\n })\n : undefined;\n\n if (params.capabilities?.permissions && authorizationRequest) {\n // The user shouldn't see this in most cases since we require\n // the account to be delegated before creating the session.\n throw new InvalidRequestError({\n message:\n \"When using a 7702 account with a session key, the account must be delegated before preparing calls.\",\n });\n }\n\n if (authorizationRequest) {\n // @ts-expect-error - this is available but not typed as public\n client.middleware.gasEstimator = default7702GasEstimator();\n }\n\n // TODO: oops we don't actually support setting the policyId as an override here\n // if we assume that the the isomorphic client is never used directly, then we can assume that this is handled upstream correctly\n const builtUo = await client.buildUserOperation({\n uo: params.calls.map((x) => ({\n target: x.to,\n data: x.data ?? \"0x\",\n value: x.value ? fromHex(x.value, \"bigint\") : undefined,\n })),\n account,\n overrides: {\n ...params.capabilities?.gasParamsOverride,\n nonceKey: params.capabilities?.nonceOverride?.nonceKey\n ? fromHex(params.capabilities.nonceOverride.nonceKey, \"bigint\")\n : undefined,\n },\n });\n\n // The eip7702Auth field should never be included in the UO sig\n // request. It's handled by a separate authorization request.\n if (\"eip7702Auth\" in builtUo) {\n builtUo.eip7702Auth = undefined;\n }\n\n const hexlifiedUo = deepHexlify(builtUo);\n\n const ep = account.getEntryPoint();\n\n const uoHash = ep.getUserOperationHash(hexlifiedUo);\n\n const uoRequest = {\n type:\n ep.version === \"0.7.0\"\n ? (\"user-operation-v070\" as const)\n : ep.version === \"0.6.0\"\n ? (\"user-operation-v060\" as const)\n : assertNever(ep.version, \"Unexpected entry point version\"),\n data: hexlifiedUo,\n chainId: toHex(client.chain.id),\n signatureRequest: {\n type: \"personal_sign\" as const,\n data: {\n raw: uoHash,\n },\n rawPayload: hashMessage({\n raw: uoHash,\n }),\n },\n };\n\n return authorizationRequest\n ? {\n type: \"array\" as const,\n data: [authorizationRequest, uoRequest],\n }\n : uoRequest;\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
|
-
import { type Chain, type Transport } from "viem";
|
|
3
|
-
import { type wallet_sendPreparedCalls } from "../../rpc/request.js";
|
|
4
|
-
import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
|
|
5
|
-
import type { Static } from "@sinclair/typebox";
|
|
6
|
-
export type SendPreparedCallsParams = Static<(typeof wallet_sendPreparedCalls)["properties"]["Request"]["properties"]["params"]>[0];
|
|
7
|
-
export type SendPreparedCallsResult = Static<(typeof wallet_sendPreparedCalls)["properties"]["ReturnType"]>;
|
|
8
|
-
export declare function sendPreparedCalls(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: SendPreparedCallsParams): Promise<SendPreparedCallsResult>;
|