Skip to content

Commit

Permalink
Merge branch 'main' into budget-edit
Browse files Browse the repository at this point in the history
  • Loading branch information
sidvishnoi committed Oct 18, 2024
2 parents f615ce3 + 0004cb9 commit db62ba4
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 17 deletions.
6 changes: 4 additions & 2 deletions src/background/services/keyAutoAdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ export function walletAddressToProvider(walletAddress: WalletAddress): {
} {
const { host } = new URL(walletAddress.id);
switch (host) {
case 'ilp.rafiki.money':
return { url: 'https://rafiki.money/settings/developer-keys' };
case 'ilp.interledger-test.dev':
return {
url: 'https://wallet.interledger-test.dev/settings/developer-keys',
};
case 'eu1.fynbos.me':
return { url: 'https://eu1.fynbos.dev/settings/keys' };
case 'fynbos.me':
Expand Down
6 changes: 3 additions & 3 deletions src/content/keyAutoAdd/testWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const getAccounts: Run<Account[]> = async (_, { setNotificationSize }) => {
});
}

const url = `https://rafiki.money/_next/data/${buildId}/settings/developer-keys.json`;
const url = `/_next/data/${buildId}/settings/developer-keys.json`;
const res = await fetch(url, {
method: 'GET',
mode: 'cors',
Expand Down Expand Up @@ -125,7 +125,7 @@ const findWallet: Run<{ accountId: string; walletId: string }> = async (

const addKey: Run<void> = async ({ publicKey, nickName }, { output }) => {
const { accountId, walletId } = output(findWallet);
const url = `https://api.rafiki.money/accounts/${accountId}/wallet-addresses/${walletId}/upload-key`;
const url = `https://api.${location.host}/accounts/${accountId}/wallet-addresses/${walletId}/upload-key`;
const res = await fetch(url, {
method: 'POST',
headers: {
Expand All @@ -147,7 +147,7 @@ const addKey: Run<void> = async ({ publicKey, nickName }, { output }) => {

// region: Helpers
async function revokeKey(accountId: string, walletId: string, keyId: string) {
const url = `https://api.rafiki.money/accounts/${accountId}/wallet-addresses/${walletId}/${keyId}/revoke-key/`;
const url = `https://api.${location.host}/accounts/${accountId}/wallet-addresses/${walletId}/${keyId}/revoke-key/`;
const res = await fetch(url, {
method: 'PATCH',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"all_frames": true
},
{
"matches": ["https://rafiki.money/*/*"],
"matches": ["https://wallet.interledger-test.dev/*"],
"js": ["content/keyAutoAdd/testWallet.js"],
"run_at": "document_end"
},
Expand Down
2 changes: 1 addition & 1 deletion src/popup/components/ConnectWalletForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export const ConnectWalletForm = ({
type="text"
label={t('connectWallet_label_walletAddress')}
id="connectWalletAddressUrl"
placeholder="https://ilp.rafiki.money/johndoe"
placeholder="https://ilp.interledger-test.dev/johndoe"
errorMessage={errors.walletAddressUrl?.message}
defaultValue={walletAddressUrl}
addOn={
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS=1

# Can replace with a localhost instance if needed. Ensure doesn't end with /
TEST_WALLET_ORIGIN=https://rafiki.money
TEST_WALLET_ORIGIN=https://wallet.interledger-test.dev
TEST_WALLET_USERNAME=[email protected]
TEST_WALLET_PASSWORD=some-password

# To connect extension to wallet
TEST_WALLET_ADDRESS_URL="https://ilp.rafiki.money/something"
TEST_WALLET_ADDRESS_URL="https://ilp.interledger-test.dev/something"
# We'll make extension use this key-pair consistently. See docs/CONTRIBUTING.md
TEST_WALLET_KEY_ID=uuid-v4-key-id
TEST_WALLET_PUBLIC_KEY="base-64-public-key=="
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/connect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test('connects with correct details provided', async ({
oneTimeGrant: {
type: 'one-time',
amount: {
value: '10000000000', // asset scale 9
value: '1000', // asset scale 2
},
},
});
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/connectAutoKeyTestWallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { disconnectWallet, fillPopup } from './pages/popup';
import { waitForWelcomePage } from './helpers/common';
import {
acceptGrant,
API_URL_ORIGIN,
KEYS_PAGE_URL,
LOGIN_PAGE_URL,
getContinueWaitTime,
revokeKey,
waitForGrantConsentPage,
Expand All @@ -21,8 +23,6 @@ test('Connect to test wallet with automatic key addition when not logged-in to w
const password = process.env.TEST_WALLET_PASSWORD;
const walletAddressUrl = process.env.TEST_WALLET_ADDRESS_URL;

const loginPageUrl = `https://rafiki.money/auth/login?callbackUrl=%2Fsettings%2Fdeveloper-keys`;

const connectButton = await test.step('fill popup', async () => {
const connectButton = await fillPopup(popup, i18n, {
walletAddressUrl,
Expand All @@ -36,7 +36,7 @@ test('Connect to test wallet with automatic key addition when not logged-in to w
await context.clearCookies();

await page.goto(KEYS_PAGE_URL);
expect(page.url()).toBe(loginPageUrl);
expect(page.url()).toBe(LOGIN_PAGE_URL);
await page.close();
});

Expand All @@ -56,7 +56,7 @@ test('Connect to test wallet with automatic key addition when not logged-in to w

page = await test.step('shows login page', async () => {
const openedPage = await context.waitForEvent('page', {
predicate: (page) => page.url().startsWith(loginPageUrl),
predicate: (page) => page.url().startsWith(LOGIN_PAGE_URL),
timeout: 3 * 1000,
});
await openedPage.getByLabel('E-mail').fill(username);
Expand All @@ -82,7 +82,7 @@ test('Connect to test wallet with automatic key addition when not logged-in to w
if (req.serviceWorker()) return;
if (req.method() !== 'POST') return;
const url = new URL(req.url());
if (url.origin !== 'https://api.rafiki.money') return;
if (url.origin !== API_URL_ORIGIN) return;
if (!url.pathname.startsWith('/accounts/')) return;
if (!url.pathname.includes('/upload-key')) return;

Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/helpers/testWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import { fillPopup, type Popup, type ConnectDetails } from '../pages/popup';
import { getWalletInformation } from '@/shared/helpers';
import { waitForWelcomePage } from './common';

export const KEYS_PAGE_URL = `https://rafiki.money/settings/developer-keys`;
export const KEYS_PAGE_URL = `https://wallet.interledger-test.dev/settings/developer-keys`;
export const LOGIN_PAGE_URL = `https://wallet.interledger-test.dev/auth/login?callbackUrl=%2Fsettings%2Fdeveloper-keys`;
export const API_URL_ORIGIN = `https://api.wallet.interledger-test.dev`;

export async function connectWallet(
context: BrowserContext,
Expand Down Expand Up @@ -93,7 +95,7 @@ export async function revokeKey(
},
) {
const { accountId, walletId, keyId } = info;
const url = `https://api.rafiki.money/accounts/${accountId}/wallet-addresses/${walletId}/${keyId}/revoke-key/`;
const url = `${API_URL_ORIGIN}/accounts/${accountId}/wallet-addresses/${walletId}/${keyId}/revoke-key/`;

await page.goto(KEYS_PAGE_URL);
await page.evaluate(async (url) => {
Expand Down

0 comments on commit db62ba4

Please sign in to comment.