Skip to content

Commit

Permalink
dev: upgrade prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
dcposch committed Sep 30, 2024
1 parent ce13c5f commit 3042bb2
Show file tree
Hide file tree
Showing 190 changed files with 3,692 additions and 3,865 deletions.
2 changes: 1 addition & 1 deletion apps/daimo-clippy/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ dotenv.config();

// || prevents build failures during CI
export const chainConfig = getChainConfig(
(process.env.DAIMO_CHAIN || "baseSepolia") as DaimoChain
(process.env.DAIMO_CHAIN || "baseSepolia") as DaimoChain,
);
25 changes: 13 additions & 12 deletions apps/daimo-clippy/src/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ let tokenListPromise: Promise<TokenList> | null = null;
async function getTokenList(): Promise<TokenList> {
if (tokenListPromise == null) {
tokenListPromise = fetch("https://tokens.coingecko.com/base/all.json").then(
(a) => a.json()
(a) => a.json(),
);
}
return tokenListPromise;
Expand Down Expand Up @@ -187,12 +187,13 @@ async function getSwapQuote(kwargs: Map<string, string>): Promise<string> {
const tokens =
chainConfig.daimoChain === "base" ? (await getTokenList()).tokens : [];
const fromToken = tokens.find(
(t) => t.symbol === strFromToken || t.address === strFromToken.toLowerCase()
(t) =>
t.symbol === strFromToken || t.address === strFromToken.toLowerCase(),
);
if (fromToken == null) return `Token '${strFromToken}' not found`;

const toToken = tokens.find(
(t) => t.symbol === strToToken || t.address === strToToken.toLowerCase()
(t) => t.symbol === strToToken || t.address === strToToken.toLowerCase(),
);
if (toToken == null) return `Token '${strToToken}' not found`;

Expand All @@ -206,7 +207,7 @@ async function getSwapQuote(kwargs: Map<string, string>): Promise<string> {
addr: getAddress("0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddead"),
},
toAddr: getAddress("0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddead"),
chainId: chainConfig.daimoChain.id,
chainId: chainConfig.chainL2.id,
});

if (!route) {
Expand All @@ -223,7 +224,7 @@ async function getSwapQuote(kwargs: Map<string, string>): Promise<string> {
`Fetched route for ${fromStr} to ${toToken.symbol}: ${JSON.stringify(
route,
null,
2
2,
)}`,
].join("\n");
}
Expand All @@ -244,7 +245,7 @@ async function grantInvite(kwargs: Map<string, string>): Promise<string> {
const maxUses = 10;

console.log(
`[SLACK-BOT] granting invite to ${name}: ${code}, $${dollars}, max ${maxUses} uses`
`[SLACK-BOT] granting invite to ${name}: ${code}, $${dollars}, max ${maxUses} uses`,
);

await createInviteCode(code, dollars, dollars, maxUses, addr);
Expand All @@ -257,10 +258,10 @@ async function grantInvite(kwargs: Map<string, string>): Promise<string> {
async function createInvite(kwargs: Map<string, string>): Promise<string> {
const code = assertNotNull(kwargs.get("code"));
const bonusDollarsInvitee = Number(
assertNotNull(kwargs.get("bonus_dollars_invitee"))
assertNotNull(kwargs.get("bonus_dollars_invitee")),
);
const bonusDollarsInviter = Number(
assertNotNull(kwargs.get("bonus_dollars_inviter"))
assertNotNull(kwargs.get("bonus_dollars_inviter")),
);
const maxUses = Number(assertNotNull(kwargs.get("max_uses")));
const inviter = getAddress(assertNotNull(kwargs.get("inviter")));
Expand All @@ -270,7 +271,7 @@ async function createInvite(kwargs: Map<string, string>): Promise<string> {
bonusDollarsInvitee,
bonusDollarsInviter,
maxUses,
inviter
inviter,
);
}

Expand All @@ -279,7 +280,7 @@ export async function createInviteCode(
bonusDollarsInvitee: number,
bonusDollarsInviter: number,
maxUses: number,
inviter: Address
inviter: Address,
) {
const res = await rpc.createInviteLink.mutate({
apiKey,
Expand All @@ -292,7 +293,7 @@ export async function createInviteCode(
const inviteStatus = await rpc.getLinkStatus.query({ url: res });

return `Successfully created invite: ${res}\n\n ${getJSONblock(
inviteStatus
inviteStatus,
)}`;
}

Expand Down Expand Up @@ -392,7 +393,7 @@ async function disableInviteBonus(kwargs: Map<string, string>) {
const inviteStatus = await rpc.getLinkStatus.query({ url: res });

return `Successfully disabled invite bonus: ${res}\n\n${getJSONblock(
inviteStatus
inviteStatus,
)}`;
}

Expand Down
6 changes: 3 additions & 3 deletions apps/daimo-mobile/src/action/actStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type ActStatus = "idle" | "loading" | "success" | "error";

export type SetActStatus = (
status: ActStatus | Error,
message?: string
message?: string,
) => void;

/** Progress & outcome of a long-running user action. */
Expand Down Expand Up @@ -37,15 +37,15 @@ export function useActStatus(name: string): [ActHandle, SetActStatus] {
}
const elapsedMs = (Date.now() - startTime.current) | 0;
console.log(
`[ACTION] ${name} - ${elapsedMs}ms: ${as.status} > ${status} ${message}`
`[ACTION] ${name} - ${elapsedMs}ms: ${as.status} > ${status} ${message}`,
);
if (status !== "loading") {
console.log(`[ACTION] ${name} - ${status}, total time ${elapsedMs}ms`);
}

set({ status, message });
},
[]
[],
);

return [as, setAS];
Expand Down
6 changes: 3 additions & 3 deletions apps/daimo-mobile/src/action/useLandlineDeposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function useLandlineDeposit({

const exec = useCallback(async () => {
console.log(
`[LANDLINE] Creating deposit for ${account.name} to ${recipient.landlineAccountUuid} for $${dollarsStr}`
`[LANDLINE] Creating deposit for ${account.name} to ${recipient.landlineAccountUuid} for $${dollarsStr}`,
);
setAS("loading", i18.depositStatus.creating());

Expand Down Expand Up @@ -83,12 +83,12 @@ export function useLandlineDeposit({

function depositAccountTransform(
account: Account,
landlineTransfer: LandlineTransfer
landlineTransfer: LandlineTransfer,
): Account {
const transferClog = landlineTransferToTransferClog(
landlineTransfer,
daimoChainFromId(account.homeChainId),
true
true,
);
return {
...account,
Expand Down
14 changes: 7 additions & 7 deletions apps/daimo-mobile/src/action/useSendAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function useSendWithDeviceKeyAsync(args: UseSendArgs) {

const keySlot = deviceAccount
? deviceAccount.accountKeys.find(
(k) => k.pubKey === deviceAccount.enclavePubKey
(k) => k.pubKey === deviceAccount.enclavePubKey,
)?.slot
: undefined;

Expand All @@ -78,7 +78,7 @@ export function useSendWithDeviceKeyAsync(args: UseSendArgs) {
keySlot,
wrappedSigner: getWrappedDeviceKeySigner(
deviceAccount.enclaveKeyName,
keySlot
keySlot,
),
account: deviceAccount,
} as DeviceKeySigner)
Expand All @@ -105,7 +105,7 @@ export function useSendAsync({

const exec = useCallback(async () => {
console.log(
`[SEND] sending userOp. account: ${account?.name}, signer: ${signer?.type}, total cost: $${cost.totalDollars}`
`[SEND] sending userOp. account: ${account?.name}, signer: ${signer?.type}, total cost: $${cost.totalDollars}`,
);
assert(account != null, "No account");

Expand Down Expand Up @@ -149,7 +149,7 @@ export function transferAccountTransform(namedAccounts: EAccount[]) {
"claimLink",
"inboundSwap",
"outboundSwap",
].includes(pendingOp.type)
].includes(pendingOp.type),
);
// Filter to new named accounts only
const findAccount = (addr: Address) =>
Expand All @@ -170,7 +170,7 @@ export function transferAccountTransform(namedAccounts: EAccount[]) {
// userop successfully authenticates the user to the API.
function addInviteLinkStatus(account: Account, pendingOp: PendingOp): Account {
console.log(
`[SEND] attaching authenticate invite link status: ${debugJson(pendingOp)}`
`[SEND] attaching authenticate invite link status: ${debugJson(pendingOp)}`,
);
const inviteLinkStatus: DaimoInviteCodeStatus | null = pendingOp.inviteCode
? {
Expand All @@ -192,7 +192,7 @@ async function sendAsync(
setAS: SetActStatus,
account: Account,
signer: Signer | undefined,
sendFn: SendOpFn
sendFn: SendOpFn,
): Promise<PendingOp> {
try {
const { address, homeChainId } = account;
Expand All @@ -218,7 +218,7 @@ async function sendAsync(
if (
e instanceof NamedError &&
["ExpoEnclaveSign", "ExpoPasskeysCreate", "ExpoPasskeysSign"].includes(
e.name
e.name,
)
) {
setAS("error", e.message);
Expand Down
10 changes: 5 additions & 5 deletions apps/daimo-mobile/src/common/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export function useNav<RouteName extends keyof AllRoutes = keyof AllRoutes>() {
}

export function useOnboardingNav<
RouteName extends keyof ParamListOnboarding = keyof ParamListOnboarding
RouteName extends keyof ParamListOnboarding = keyof ParamListOnboarding,
>() {
return useNavigation<
NativeStackNavigationProp<ParamListOnboarding, RouteName>
Expand Down Expand Up @@ -219,7 +219,7 @@ export function useOnboardingDeepLinkHandler(dc: DaimoChain) {
export async function handleOnboardingDeepLink(
dc: DaimoChain,
nav: OnboardingNav,
str: string
str: string,
) {
console.log(`[INTRO] paste invite link: '${str}'`);
try {
Expand Down Expand Up @@ -250,7 +250,7 @@ export function handleDeepLink(
nav: MainNav,
dispatcher: Dispatcher,
url: string,
homeChainId: number
homeChainId: number,
) {
const link = parseDaimoLink(url);
if (link == null) {
Expand All @@ -267,7 +267,7 @@ async function goTo(
nav: MainNav,
dispatcher: Dispatcher,
link: DaimoLink,
homeChainId: number
homeChainId: number,
) {
const { type } = link;
switch (type) {
Expand Down Expand Up @@ -303,7 +303,7 @@ async function goTo(
// TODO: pass link status through so child pages don't need to fetch status again
const linkStatus = await fetchLinkStatus(
link,
daimoChainFromId(homeChainId)
daimoChainFromId(homeChainId),
);
goTo(nav, dispatcher, linkStatus.link, homeChainId);
break;
Expand Down
4 changes: 2 additions & 2 deletions apps/daimo-mobile/src/common/useSendDebugLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function SendDebugLogButton() {
* Additionally returns the env summary for display.
*/
export function useSendDebugLog(
account?: Account | null
account?: Account | null,
): [() => Promise<void>, Record<string, string>] {
if (account === undefined) {
account = getAccountManager().getAccount();
Expand Down Expand Up @@ -77,7 +77,7 @@ export function useSendDebugLog(
return [sendDebugLog, envKV];
}
function getKeySecDescription(
hardwareSecurityLevel: ExpoEnclave.HardwareSecurityLevel
hardwareSecurityLevel: ExpoEnclave.HardwareSecurityLevel,
) {
switch (hardwareSecurityLevel) {
case "SOFTWARE":
Expand Down
2 changes: 1 addition & 1 deletion apps/daimo-mobile/src/i18n/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ export const es: LanguageDefinition = {
left: (usesLeft: number) =>
`${usesLeft} ${pluralize(usesLeft, "invitación")} ${pluralize(
usesLeft,
"restantes"
"restantes",
)}`,
locked: {
header: () => `Invita tus amigos y gana USDC!`,
Expand Down
20 changes: 10 additions & 10 deletions apps/daimo-mobile/src/logic/accountManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class AccountManager {
console.log(`[ACTION] pollForAccountByKey saving ${acc.name}, ${acc.addr}`);
if (this.currentAccount != null) {
console.log(
`[ACCOUNT] ignoring found account, already have ${this.currentAccount.name}`
`[ACCOUNT] ignoring found account, already have ${this.currentAccount.name}`,
);
return;
}
Expand All @@ -234,7 +234,7 @@ class AccountManager {
// Create new account
async createAccount(name: string, inviteLink: DaimoLink) {
console.log(
`[ACCOUNT] createAccount ${name}, ${formatDaimoLink(inviteLink)}`
`[ACCOUNT] createAccount ${name}, ${formatDaimoLink(inviteLink)}`,
);
const existingAcc = this.currentAccount;
assert(existingAcc == null, "Can't create, have existing account");
Expand Down Expand Up @@ -277,7 +277,7 @@ class AccountManager {
this.setNewAccount(enclaveKeyName, pubKeyHex, name, address);
} else {
console.log(
`[ACCOUNT] createAccount NOT saving, existing (polled) acct ${this.currentAccount.name}`
`[ACCOUNT] createAccount NOT saving, existing (polled) acct ${this.currentAccount.name}`,
);
}

Expand Down Expand Up @@ -311,7 +311,7 @@ class AccountManager {
enclaveKeyName: string,
enclavePubKey: Hex,
name: string,
address: Address
address: Address,
) {
assert(this.currentAccount == null, "Can't create, have existing account");
const newAcc = createEmptyAccount(
Expand All @@ -321,15 +321,15 @@ class AccountManager {
name,
address,
},
this.daimoChain
this.daimoChain,
);
this.setCurrentAccount(newAcc); // Saves account, notifies listeners
}

// Returns a pending claimLink op.
private async tryClaimPaymentLink(
address: Address,
inviteLink: DaimoLinkNoteV2
inviteLink: DaimoLinkNoteV2,
) {
const rpcFunc = getRpcFunc(this.daimoChain);
const sanitizedUrl = formatDaimoLink(stripSeedFromNoteLink(inviteLink));
Expand All @@ -346,7 +346,7 @@ class AccountManager {
const txHash = await this.sendClaimPaymentLinkTx(
address,
inviteLink,
noteStatus
noteStatus,
);
cacheEAccounts([noteStatus.sender]);
const pendingOp = {
Expand All @@ -373,13 +373,13 @@ class AccountManager {
private async sendClaimPaymentLinkTx(
address: Address,
inviteLink: DaimoLinkNoteV2,
noteStatus: DaimoNoteStatus
noteStatus: DaimoNoteStatus,
) {
const rpcFunc = getRpcFunc(this.daimoChain);
const ephemeralSignature = await getNoteClaimSignatureFromSeed(
noteStatus.sender.addr,
address,
inviteLink.seed
inviteLink.seed,
);
const claimTxHash = await rpcFunc.claimEphemeralNoteSponsored.mutate({
ephemeralOwner: noteStatus.ephemeralOwner!,
Expand Down Expand Up @@ -431,7 +431,7 @@ export function useAccount(): Account | null {

// State + listeners pattern
const [accState, setAccState] = useState<Account | null>(
manager.getAccount()
manager.getAccount(),
);
useEffect(() => {
manager.addListener(setAccState);
Expand Down
Loading

0 comments on commit 3042bb2

Please sign in to comment.