Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tender-sloths-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@exactly/mobile": patch
---

♿️ add aria label to loan amount selector
19 changes: 16 additions & 3 deletions .maestro/flows/local.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
appId: ${APP_ID ?? "app.exactly"}
tags:
- critical
tags: [critical]
---
- launchApp: { clearState: true, permissions: { all: deny, camera: allow } }
- runFlow: ../subflows/hideDevtools.yaml
Expand All @@ -24,14 +23,28 @@ tags:
env: { asset: USDC, to: "${output.account}", amount: "420" }
- tapOn: Home
- runFlow: ../subflows/readPortfolio.yaml
- runFlow:
when: { true: "${output.portfolio === output.portfolioBefore}" }
commands: [{ tapOn: Home }, { runFlow: ../subflows/readPortfolio.yaml }]
- assertTrue: ${output.portfolio - output.portfolioBefore === 420}
- evalScript: ${output.portfolioBefore = output.portfolio}
- runScript: ../dist/getAccount.js
- runFlow:
file: ../subflows/sendAsset.yaml
env: { asset: USDC, to: "${output.owner}", amount: "69" }
- tapOn: Home
- repeat: { while: { visible: Pending proposals }, commands: [{ tapOn: Home }] }
- runFlow: # HACK https://github.com/mobile-dev-inc/Maestro/issues/2914
when: { true: "${maestro.platform != 'web'}" }
commands:
- repeat:
while: { visible: Pending proposals }
commands: [{ tapOn: Home }]
- runFlow: # HACK https://github.com/mobile-dev-inc/Maestro/issues/2914
when: { platform: web }
commands:
- repeat:
while: { visible: Pending proposals }
commands: [{ tapOn: { id: Home } }]
- runFlow: ../subflows/readPortfolio.yaml
- assertTrue: ${output.portfolioBefore - output.portfolio === 69}
- runFlow:
Expand Down
3 changes: 1 addition & 2 deletions .maestro/flows/production.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
appId: ${APP_ID ?? "app.exactly"}
tags:
- production
tags: [production]
---
- launchApp: { clearState: true, permissions: { all: deny, camera: allow } }
- runFlow: ../subflows/hideDevtools.yaml
Expand Down
9 changes: 7 additions & 2 deletions common/onesignalAppId.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import domain from "./domain";

export default (process.env.EXPO_PUBLIC_ONESIGNAL_APP_ID || // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- ignore empty string
{ "web.exactly.app": "31d4be98-1fa3-4a8c-9657-dc21c991adc7" }[domain]) ??
"15bd3cf9-f71e-43f2-96ff-e76916a832a3";
{
"web.exactly.app": "31d4be98-1fa3-4a8c-9657-dc21c991adc7",
"base.exactly.app": "9f896065-637d-455c-baff-4041268dafce",
"sandbox.exactly.app": "15bd3cf9-f71e-43f2-96ff-e76916a832a3",
"base-sepolia.exactly.app": "893d33c6-d1bd-46cb-9047-d4d524f384f0",
}[domain]) ??
"2f79a35c-8b11-4725-84d8-fc096f3f216e";
2 changes: 1 addition & 1 deletion server/script/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ process.on("uncaughtException", () => null);
process.stdout.on("error", () => null);
process.stderr.on("error", () => null);

const v = spawn("vitest", ["run"], { stdio: ["ignore", "pipe", "pipe"], env: { ...process.env, FORCE_COLOR: "1" } });
const v = spawn("vitest", ["--watch"], { stdio: ["ignore", "pipe", "pipe"], env: { ...process.env, FORCE_COLOR: "1" } });

v.stdout.pipe(process.stdout);
v.stderr.pipe(process.stderr);
Expand Down
3 changes: 3 additions & 0 deletions src/components/loans/AmountSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useCallback, useState } from "react";
import { useTranslation } from "react-i18next";

import { Separator, XStack, YStack } from "tamagui";

Expand All @@ -20,6 +21,7 @@ export default function AmountSelector({
market: Hex;
onChange: (value: bigint, highAmount: boolean) => void;
}) {
const { t } = useTranslation();
const { market: selectedMarket, borrowAvailable } = useAsset(market);
const { Field, setFieldValue, getFieldValue } = useForm({ defaultValues: { assetInput: "" } });
const [focused, setFocused] = useState(false);
Expand Down Expand Up @@ -89,6 +91,7 @@ export default function AmountSelector({
height={32}
/>
<Input
aria-label={t("Amount")}
height="auto"
inputMode="decimal"
onChangeText={handleAmountChange}
Expand Down
43 changes: 34 additions & 9 deletions src/utils/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,36 @@ import { Platform } from "react-native";

import { useMutation } from "@tanstack/react-query";
import {
concat,
createWalletClient,
hexToBigInt,
hexToNumber,
http,
isHex,
numberToHex,
sliceHex,
trim,
type EIP1193Provider,
type EIP1193RequestFn,
type WalletSendCallsParameters,
} from "viem";
import { mnemonicToAccount } from "viem/accounts";
import { mnemonicToAccount, nonceManager } from "viem/accounts";

import chain from "@exactly/common/generated/chain";

import publicClient from "./publicClient";

const account =
typeof window !== "undefined" && process.env.EXPO_PUBLIC_ENV === "e2e"
? mnemonicToAccount(
process.env.EXPO_PUBLIC_E2E_MNEMONIC || "test test test test test test test test test test test junk", // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- ignore empty string
{ nonceManager },
)
: undefined;
const client = account && createWalletClient({ chain, account, transport: http() });
export default client;

const TX_MAGIC_ID = "0x5792579257925792579257925792579257925792579257925792579257925792";

if (client) {
window.ethereum = {
request: (async ({ method, params }) => {
Expand All @@ -43,13 +52,29 @@ if (client) {
if (!Array.isArray(params) || params.length !== 1) throw new Error("bad params");
const [{ from, calls }] = params as WalletSendCallsParameters;
if (from && from !== account.address) throw new Error("bad account");
for (const { to, data, value } of calls) {
client
.sendTransaction({ to, data, value: value && hexToBigInt(value), gas: 6_666_666n })
.then(console.log) // eslint-disable-line no-console
.catch(console.error); // eslint-disable-line no-console
}
return { result: null };
const hashes = await Promise.all(
calls.map(({ to, data, value }) =>
client.sendTransaction({ to, data, value: value && BigInt(value), gas: 6_666_666n }),
),
);
return { id: concat([...hashes, numberToHex(chain.id, { size: 32 }), TX_MAGIC_ID]) };
}
case "wallet_getCallsStatus": {
if (!Array.isArray(params) || params.length !== 1 || !isHex(params[0])) throw new Error("bad");
const [id] = params;
const receipts = await Promise.all(
Array.from({ length: (id.length - 2) / 2 / 32 - 2 }, (_, index) =>
publicClient.getTransactionReceipt({ hash: sliceHex(id, index * 32, (index + 1) * 32) }),
),
);
return {
version: "2.0.0",
id,
atomic: true,
receipts,
status: receipts.every((r) => r.status === "success") ? 200 : 500,
chainId: hexToNumber(trim(sliceHex(id, -64, -32))),
};
}
default:
throw new Error(`${method} not supported`);
Expand Down
Loading