From f1089a9807c6728fab6818706737e9d05afd78e9 Mon Sep 17 00:00:00 2001 From: Blake Duncan Date: Thu, 26 Oct 2023 16:26:19 -0400 Subject: [PATCH] chore: fix linting issues --- .github/workflows/main.yml | 6 +-- .../kernel-zerodev/owner/getCustodialOwner.ts | 52 ++++++++++++------- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b479bc83..a1e83d0c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,11 +35,11 @@ jobs: run: yarn build - name: Link SDK - run: yarn --cwd packages/accounts link - + run: yarn --cwd packages/accounts link + - name: Install E2E tests run: yarn --cwd e2e-tests link @zerodev/sdk && yarn --cwd e2e-tests - + - name: E2E tests env: API_KEY: ${{ secrets.API_KEY }} diff --git a/packages/accounts/src/kernel-zerodev/owner/getCustodialOwner.ts b/packages/accounts/src/kernel-zerodev/owner/getCustodialOwner.ts index 6008473e..195e3d49 100644 --- a/packages/accounts/src/kernel-zerodev/owner/getCustodialOwner.ts +++ b/packages/accounts/src/kernel-zerodev/owner/getCustodialOwner.ts @@ -1,7 +1,7 @@ -import type {SignTypedDataParams, SmartAccountSigner} from "@alchemy/aa-core"; +import type { SignTypedDataParams, SmartAccountSigner } from "@alchemy/aa-core"; import { API_URL } from "../constants.js"; import axios from "axios"; -import {TurnkeyClient} from "@turnkey/http"; +import { TurnkeyClient } from "@turnkey/http"; /** * Params to get a custodial owner @@ -20,7 +20,7 @@ type GetCustodialOwnerParams = { // Or read them from the custodial file path custodialFilePath?: string; -} +}; /** * Returns a signer for a custodial wallet via TurnKey @@ -54,7 +54,7 @@ export async function getCustodialOwner( // Ensure we have the required values if (!privateKey || !publicKey || !keyId) { throw new Error( - "Must provide custodialFilePath or privateKey, publicKey, and keyId." + "Must provide custodialFilePath or privateKey, publicKey, and keyId." ); } @@ -65,34 +65,45 @@ export async function getCustodialOwner( let ApiKeyStamper; // TODO: Would be cleaner with something like radash and a tryit function? try { - TurnkeyClient = require.resolve("@turnkey/http") && require("@turnkey/http").TurnkeyClient; - ApiKeyStamper = require.resolve("@turnkey/api-key-stamper") && require("@turnkey/api-key-stamper").ApiKeyStamper; + TurnkeyClient = + require.resolve("@turnkey/http") && + require("@turnkey/http").TurnkeyClient; + ApiKeyStamper = + require.resolve("@turnkey/api-key-stamper") && + require("@turnkey/api-key-stamper").ApiKeyStamper; } catch (error) { - console.log("@turnkey/http or @turnkey/api-key-stamper module not available. Skipping FS operation..."); - return; + console.log( + "@turnkey/http or @turnkey/api-key-stamper module not available. Skipping FS operation..." + ); + return; } // Build the turnkey client turnKeyClient = new TurnkeyClient( - { - baseUrl: "https://api.turnkey.com", - }, - new ApiKeyStamper({ - apiPublicKey: publicKey, - apiPrivateKey: privateKey, - }) + { + baseUrl: "https://api.turnkey.com", + }, + new ApiKeyStamper({ + apiPublicKey: publicKey, + apiPrivateKey: privateKey, + }) ); } // Get the wallet identifier from the API - const response = await axios.post(`${apiUrl}/wallets/${identifier}`, { - keyId, - }); + const response = await axios.post( + `${apiUrl}/wallets/${identifier}`, + { + keyId, + } + ); // Build the turnkey viem account let createAccount; try { - createAccount = require.resolve("@turnkey/viem") && require("@turnkey/viem").createAccount; + createAccount = + require.resolve("@turnkey/viem") && + require("@turnkey/viem").createAccount; } catch (error) { console.log("@turnkey/viem module not available. Skipping FS operation..."); return; @@ -115,6 +126,7 @@ export async function getCustodialOwner( return turnkeySigner.signMessage({ message: { raw: msg } }); } }, - signTypedData: async (params: SignTypedDataParams) => turnkeySigner.signTypedData(params), + signTypedData: async (params: SignTypedDataParams) => + turnkeySigner.signTypedData(params), }; }