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
7 changes: 6 additions & 1 deletion .github/workflows/deployFreighterApiBeta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
uses: actions/checkout@v4
with:
ref: release/${{ github.event.inputs.release }}
- name: Enable Corepack
run: corepack enable
- name: Build package
uses: actions/setup-node@v4
with:
Expand All @@ -41,7 +43,10 @@ jobs:
SLACK_CHANNEL: team-wallet-eng
SLACK_COLOR: "#70E1C8"
SLACK_ICON: https://github.com/stellar/freighter/blob/master/docs/static/images/logo.png?size=48
SLACK_MESSAGE: "https://github.com/stellar/freighter/releases/tag/${{ github.event.inputs.release }}-beta.${{ github.event.inputs.version }}"
SLACK_MESSAGE:
"https://github.com/stellar/freighter/releases/tag/${{
github.event.inputs.release }}-beta.${{ github.event.inputs.version
}}"
SLACK_TITLE: "@stellar/freighter-api beta has been deployed to npm!"
SLACK_USERNAME: Freighter Administrative Assistant
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
2 changes: 2 additions & 0 deletions .github/workflows/deployFreighterApiProduction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
- name: Build package
uses: actions/setup-node@v4
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/runSnapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- run: npm install -g yarn && yarn
- run: yarn
- run: npx playwright install --with-deps chromium
- run: yarn setup
- run: yarn build:freighter-api
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/runTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm install -g yarn && yarn
- run: yarn
- run: npx playwright install --with-deps chromium
- run: yarn setup
- run: yarn build:freighter-api
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/submitBeta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ jobs:
value:
${{ github.event.inputs.release }}.${{ github.event.inputs.version
}}
- name: Enable Corepack
run: corepack enable
- name: Build extension
uses: actions/setup-node@v4
with:
node-version: 22
- run:
yarn setup && yarn build:freighter-api && yarn
build:extension:production
- run: yarn && yarn build:freighter-api && yarn build:extension:production
- name: Use BETA icons
run: |
rm -rf ./extension/build/images
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/submitProduction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@ jobs:
file: ./extension/public/static/manifest/v3.json
field: version
value: ${{ steps.manifest_version.outputs.replaced }}
- name: Enable Corepack
run: corepack enable
- name: Build extension
uses: actions/setup-node@v4
with:
node-version: 22
- run:
yarn setup && yarn build:freighter-api && yarn
build:extension:production --env AMPLITUDE_KEY="${{
secrets.AMPLITUDE_KEY }}" SENTRY_KEY="${{ secrets.SENTRY_KEY }}"
yarn && yarn build:freighter-api && yarn build:extension:production
--env AMPLITUDE_KEY="${{ secrets.AMPLITUDE_KEY }}" SENTRY_KEY="${{
secrets.SENTRY_KEY }}"
- name: Install zip
uses: montudor/action-zip@0852c26906e00f8a315c704958823928d8018b28 #v1.0.0
- name: Commit files
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/submitSafari.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:
file: ./extension/public/static/manifest/v3.json
field: version
value: ${{ steps.manifest_version.outputs.replaced }}
- name: Enable Corepack
run: corepack enable
- name: Build extension
uses: actions/setup-node@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ node_modules
.env.development.local
.env.test.local
.env.production.local
.yarn
.yarn/*

npm-debug.log*
yarn-debug.log*
Expand Down
1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
enableScripts: false

nodeLinker: node-modules
4 changes: 2 additions & 2 deletions @shared/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"@stellar/js-xdr": "3.1.2",
"bignumber.js": "9.3.0",
"prettier": "3.5.3",
"stellar-sdk": "yarn:@stellar/stellar-sdk@14.1.1",
"stellar-sdk-next": "yarn:@stellar/stellar-sdk@14.1.1",
"stellar-sdk": "npm:@stellar/stellar-sdk@14.1.1",
"stellar-sdk-next": "npm:@stellar/stellar-sdk@14.1.1",
"typescript": "5.8.3",
"webextension-polyfill": "0.12.0"
},
Expand Down
1 change: 1 addition & 0 deletions @shared/api/types/account-balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface NativeAsset {
total: BigNumber;
buyingLiabilities: string;
sellingLiabilities: string;
minimumBalance: string;
blockaidData: Blockaid.TokenScanResponse;
}

Expand Down
4 changes: 2 additions & 2 deletions @shared/constants/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"prettier": "../../.prettierrc.yaml",
"version": "1.0.0",
"dependencies": {
"stellar-sdk": "yarn:@stellar/stellar-sdk@14.1.1",
"stellar-sdk-next": "yarn:@stellar/stellar-sdk@14.1.1",
"stellar-sdk": "npm:@stellar/stellar-sdk@14.1.1",
"stellar-sdk-next": "npm:@stellar/stellar-sdk@14.1.1",
"typescript": "5.8.3"
},
"devDependencies": {
Expand Down
7 changes: 3 additions & 4 deletions @shared/helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
"version": "1.0.0",
"dependencies": {
"bignumber.js": "9.3.0",
"stellar-sdk": "yarn:@stellar/stellar-sdk@14.1.1",
"stellar-sdk-next": "yarn:@stellar/stellar-sdk@14.1.1",
"stellar-sdk": "npm:@stellar/stellar-sdk@14.1.1",
"stellar-sdk-next": "npm:@stellar/stellar-sdk@14.1.1",
"typescript": "5.8.3"
},
"devDependencies": {}
}
}
93 changes: 91 additions & 2 deletions extension/e2e-tests/addAsset.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect, expectPageToHaveScreenshot } from "./test-fixtures";
import { loginToTestAccount } from "./helpers/login";
import { loginAndFund, loginToTestAccount } from "./helpers/login";
import { TEST_TOKEN_ADDRESS, USDC_TOKEN_ADDRESS } from "./helpers/test-token";
import {
stubAccountBalances,
Expand All @@ -9,8 +9,12 @@ import {
} from "./helpers/stubs";
import { truncateString } from "../src/helpers/stellar";

test("Adding unverified Soroban token", async ({ page, extensionId }) => {
test("Adding and removing unverified Soroban token", async ({
page,
extensionId,
}) => {
test.slow();
await stubTokenDetails(page);
await loginToTestAccount({ page, extensionId });

await page.getByTestId("account-options-dropdown").click();
Expand Down Expand Up @@ -48,6 +52,46 @@ test("Adding unverified Soroban token", async ({ page, extensionId }) => {
"Expected token to be either on or not on lists, but neither was visible",
);
}
await page.getByTestId("ManageAssetRowButton").click();
await expect(page.getByTestId("ToggleToken__asset-code")).toHaveText(
"E2E Token",
);
await expect(page.getByTestId("ToggleToken__asset-add-remove")).toHaveText(
"Add Token",
);
await page.getByRole("button", { name: "Confirm" }).click();
await expect(
page.getByTestId("ManageAssetRowButton__ellipsis-E2E"),
).toBeVisible();

// now go back and make sure the asset is displayed in the account view
await page.getByTestId("BackButton").click();
await page.getByTestId("BackButton").click();
await expect(page.getByTestId("account-view")).toBeVisible();
await expect(page.getByText("E2E")).toBeVisible();

// now go back and remove this asset
await page.getByTestId("account-options-dropdown").click();
await page.getByText("Manage assets").click();
await expect(page.getByText("Your assets")).toBeVisible();
await expect(page.getByTestId("ManageAssetCode")).toHaveText("E2E");
await expect(page.getByTestId("ManageAssetDomain")).toHaveText(
"Stellar Network",
);
await page.getByTestId("ManageAssetRowButton__ellipsis-E2E").click();
await page.getByText("Remove asset").click();
await expect(page.getByTestId("ToggleToken__asset-code")).toHaveText(
"CBVX…HWXJ",
);
await expect(page.getByTestId("ToggleToken__asset-add-remove")).toHaveText(
"Remove Token",
);
await page.getByRole("button", { name: "Confirm" }).click();
await expect(
page.getByText(
"You have no assets added. Get started by adding an asset below.",
),
).toBeVisible();
});

// Skipping this test because on Testnet, stellar.expert's asset list is formatter incorrectly
Expand Down Expand Up @@ -116,6 +160,51 @@ test("Adding token on Futurenet", async ({ page, extensionId, context }) => {
await page.getByText("Add an asset").click({ force: true });
await expect(page.getByTestId("search-token-input")).toBeVisible();
});
test("Adding classic asset on Testnet", async ({ page, extensionId }) => {
test.slow();
await loginAndFund({ page, extensionId });

await page.getByTestId("account-options-dropdown").click();
await page.getByText("Manage assets").click();
await expect(page.getByText("Your assets")).toBeVisible();
await page.getByText("Add an asset").click({ force: true });
await page
.getByTestId("search-asset-input")
.fill("GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5");
await expect(page.getByText("USDC")).toBeVisible();

await page.getByTestId("ManageAssetRowButton").click();
await expect(
page.getByTestId("SignTransaction__TrustlineRow__Asset"),
).toHaveText("USDC");
await expect(
page.getByTestId("SignTransaction__TrustlineRow__Type"),
).toHaveText("Add Trustline");
await page.getByRole("button", { name: "Confirm" }).click();
await expect(
page.getByTestId("ManageAssetRowButton__ellipsis-USDC"),
).toBeVisible();

// now go back and remove this asset
await page.getByTestId("BackButton").click();
await expect(page.getByText("Your assets")).toBeVisible();
await expect(page.getByTestId("ManageAssetCode")).toHaveText("USDC");
await expect(page.getByTestId("ManageAssetDomain")).toHaveText("centre.io");
await page.getByTestId("ManageAssetRowButton__ellipsis-USDC").click();
await page.getByText("Remove asset").click();
await expect(
page.getByTestId("SignTransaction__TrustlineRow__Asset"),
).toHaveText("USDC");
await expect(
page.getByTestId("SignTransaction__TrustlineRow__Type"),
).toHaveText("Remove Trustline");
await page.getByRole("button", { name: "Confirm" }).click();
await expect(
page.getByText(
"You have no assets added. Get started by adding an asset below.",
),
).toBeVisible();
});
test.afterAll(async ({ page, extensionId }) => {
if (
process.env.IS_INTEGRATION_MODE &&
Expand Down
12 changes: 5 additions & 7 deletions extension/e2e-tests/helpers/stubs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BrowserContext, Page } from "@playwright/test";
import { USDC_TOKEN_ADDRESS } from "./test-token";
import { USDC_TOKEN_ADDRESS, TEST_TOKEN_ADDRESS } from "./test-token";

export const STELLAR_EXPERT_ASSET_LIST_JSON = {
name: "StellarExpert Top 50",
Expand Down Expand Up @@ -81,9 +81,7 @@ export const stubTokenDetails = async (page: Page | BrowserContext) => {
decimals: 7,
symbol: "native",
};
if (
tokenId === "CBXQIAGT7PN6T2FD3BLFQTN3L2YE4O7MNP3BF32ZPBD3V4BSFPOU3OJG"
) {
if (tokenId === TEST_TOKEN_ADDRESS) {
json = {
name: "E2E Token",
decimals: 3,
Expand Down Expand Up @@ -134,7 +132,7 @@ export const stubTokenPrices = async (page: Page | BrowserContext) => {
});
};

export const stubAccountBalances = async (page: Page) => {
export const stubAccountBalances = async (page: Page, xlmBalance?: string) => {
await page.route("**/account-balances/**", async (route) => {
const json = {
balances: {
Expand All @@ -143,8 +141,8 @@ export const stubAccountBalances = async (page: Page) => {
type: "native",
code: "XLM",
},
total: "9697.8556678",
available: "9697.8556678",
total: xlmBalance || "9697.8556678",
available: xlmBalance || "9697.8556678",
sellingLiabilities: "0",
buyingLiabilities: "0",
minimumBalance: "1",
Expand Down
Loading
Loading