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
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { ValidationResponseCard } from "@/components/ValidationResponseCard";
import { TransactionXdrDisplay } from "./TransactionXdrDisplay";

export const SorobanTransactionXdr = () => {
const { network, transaction } = useStore();
const { isValid } = transaction.build;
const { network } = useStore();
const { build, setBuildSorobanXdr } = useBuildFlowStore();
const { isValid } = build;
const { soroban } = build;

useEffect(() => {
Expand All @@ -24,12 +24,6 @@ export const SorobanTransactionXdr = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isValid.params, isValid.operations]);

// Sync soroban XDR to the new flow store
useEffect(() => {
setBuildSorobanXdr(soroban.xdr);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [soroban.xdr]);

if (!(isValid.params && isValid.operations)) {
return null;
}
Expand Down
125 changes: 33 additions & 92 deletions tests/e2e/buildTransaction.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { baseURL } from "../../playwright.config";
import { test, expect, Page } from "@playwright/test";
import { mockSimulateTx } from "./mock/helpers";

test.describe.skip("Build Transaction Page", () => {
test.describe("Build Transaction Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto(`${baseURL}/transaction/build`);
});
Expand Down Expand Up @@ -34,10 +33,6 @@ test.describe.skip("Build Transaction Page", () => {
await page.getByLabel("Source account").fill(SOURCE_ACCOUNT);
await page.getByLabel("Transaction sequence number").fill(SEQUENCE_NUMBER);

const saveTxButton = page.getByTitle("Save transaction");

await expect(saveTxButton).toBeDisabled();

const { operation_0 } = await selectOperationType({
page,
opType: "create_account",
Expand All @@ -46,7 +41,11 @@ test.describe.skip("Build Transaction Page", () => {
await operation_0.getByLabel("Destination").fill(ACCOUNT_ONE);
await operation_0.getByLabel("Starting balance").fill("1");

await expect(saveTxButton).toBeEnabled();
const saveTxButton = page.getByRole("button", {
name: "Save transaction",
});

await expect(saveTxButton).toBeVisible();
await saveTxButton.click();

const modal = page.locator(".Modal");
Expand Down Expand Up @@ -127,7 +126,7 @@ test.describe.skip("Build Transaction Page", () => {

// Clear params
await expect(paramsErrors).toBeHidden();
await page.getByText("Clear Params").click();
await page.getByText("Clear all").click();
await expect(paramsErrors).toBeVisible();
});

Expand Down Expand Up @@ -1320,7 +1319,7 @@ test.describe.skip("Build Transaction Page", () => {
// Verify warning message about one operation limit
await expect(
page.getByText(
"Note that Soroban transactions can only contain one operation per transaction.",
"Soroban transaction can only contain one operation per transaction.",
),
).toBeVisible();

Expand Down Expand Up @@ -1376,26 +1375,12 @@ test.describe.skip("Build Transaction Page", () => {
.getByLabel("Resource Fee (in stroops)")
.fill("60528");

const prepareTxButton = page.getByText(
"Prepare Soroban Transaction to Sign",
);

// Mock simulate transaction RPC call
await mockSimulateTx({
page,
responseXdr:
"AAAAAAAAAAEAAAAGAAAAASAi1W4KumRRb25iYE0pYjK+hk/9+4TVhhPnQjys4CsoAAAAEAAAAAEAAAACAAAADwAAAAdCYWxhbmNlAAAAABIAAAABhJOf5nl4Ckvd0A0luFhIy7AmbhcWcGZUrcpt0K5oj5wAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOxy",
});

await expect(prepareTxButton).toBeEnabled();
await prepareTxButton.click();

await testOpSuccessHashAndXdr({
isSorobanOp: true,
page,
hash: "6eaff5a4593b5387b5898d4575fa857fa58754817c8ddb80a6c6008e2191b11c",
xdr: "AAAAAgAAAAANLHqVohDTxPKQ3fawTPgHahe0TzJjJkWV1WakcbeADgACWZEAD95QAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAGQAAAAAAJA8xAAAAAQAAAAAAAAABAAAABgAAAAEgItVuCrpkUW9uYmBNKWIyvoZP/fuE1YYT50I8rOArKAAAABAAAAABAAAAAgAAAA8AAAAHQmFsYW5jZQAAAAASAAAAAYSTn+Z5eApL3dANJbhYSMuwJm4XFnBmVK3KbdCuaI+cAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAADscgAAAAA=",
// In the new flow, extend_footprint_ttl does not produce XDR on
// the build step — verify the Next button is enabled (form valid).
const nextButton = page.getByRole("button", {
name: /Next: Simulate/,
});
await expect(nextButton).toBeEnabled();
});

test("[Use Contract Data Key] Happy path", async ({ page }) => {
Expand All @@ -1414,7 +1399,7 @@ test.describe.skip("Build Transaction Page", () => {
// Verify warning message about one operation limit
await expect(
page.getByText(
"Note that Soroban transactions can only contain one operation per transaction.",
"Soroban transaction can only contain one operation per transaction.",
),
).toBeVisible();

Expand Down Expand Up @@ -1514,26 +1499,12 @@ test.describe.skip("Build Transaction Page", () => {
.getByLabel("Resource Fee (in stroops)")
.fill("60528");

const prepareTxButton = page.getByText(
"Prepare Soroban Transaction to Sign",
);

// Mock simulate transaction RPC call
await mockSimulateTx({
page,
responseXdr:
"AAAAAAAAAAEAAAAGAAAAASAi1W4KumRRb25iYE0pYjK+hk/9+4TVhhPnQjys4CsoAAAAEAAAAAEAAAACAAAADwAAAAdCYWxhbmNlAAAAABIAAAABhJOf5nl4Ckvd0A0luFhIy7AmbhcWcGZUrcpt0K5oj5wAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOxy",
});

await expect(prepareTxButton).toBeEnabled();
await prepareTxButton.click();

await testOpSuccessHashAndXdr({
isSorobanOp: true,
page,
hash: "6eaff5a4593b5387b5898d4575fa857fa58754817c8ddb80a6c6008e2191b11c",
xdr: "AAAAAgAAAAANLHqVohDTxPKQ3fawTPgHahe0TzJjJkWV1WakcbeADgACWZEAD95QAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAGQAAAAAAJA8xAAAAAQAAAAAAAAABAAAABgAAAAEgItVuCrpkUW9uYmBNKWIyvoZP/fuE1YYT50I8rOArKAAAABAAAAABAAAAAgAAAA8AAAAHQmFsYW5jZQAAAAASAAAAAYSTn+Z5eApL3dANJbhYSMuwJm4XFnBmVK3KbdCuaI+cAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAADscgAAAAA=",
// In the new flow, extend_footprint_ttl does not produce XDR on
// the build step — verify the Next button is enabled (form valid).
const nextButton = page.getByRole("button", {
name: /Next: Simulate/,
});
await expect(nextButton).toBeEnabled();
});

test("[Use Contract Data Key] Validation", async ({ page }) => {
Expand Down Expand Up @@ -1639,7 +1610,7 @@ test.describe.skip("Build Transaction Page", () => {
// Verify warning message about one operation limit
await expect(
page.getByText(
"Note that Soroban transactions can only contain one operation per transaction.",
"Soroban transaction can only contain one operation per transaction.",
),
).toBeVisible();

Expand Down Expand Up @@ -1680,7 +1651,7 @@ test.describe.skip("Build Transaction Page", () => {
// Verify warning message about one operation limit
await expect(
page.getByText(
"Note that Soroban transactions can only contain one operation per transaction.",
"Soroban transaction can only contain one operation per transaction.",
),
).toBeVisible();

Expand Down Expand Up @@ -1734,27 +1705,12 @@ test.describe.skip("Build Transaction Page", () => {
.getByLabel("Resource Fee (in stroops)")
.fill("20000");

const prepareTxButton = page.getByText(
"Prepare Soroban Transaction to Sign",
);

// Mock simulate transaction RPC call
// @TODO update this after investigating restore footprint
await mockSimulateTx({
page,
responseXdr: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATiA=",
});

await expect(prepareTxButton).toBeEnabled();
await prepareTxButton.click();

// @TODO update this after investigating restore footprint
await testOpSuccessHashAndXdr({
isSorobanOp: true,
page,
hash: "aa5a5bd20265afdee0d01d36add7b9e67364516e69339313be2c174c8ee81313",
xdr: "AAAAAgAAAAANLHqVohDTxPKQ3fawTPgHahe0TzJjJkWV1WakcbeADgABu0EAD95QAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAGgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATiAAAAAA",
// In the new flow, restore_footprint does not produce XDR on
// the build step — verify the Next button is enabled (form valid).
const nextButton = page.getByRole("button", {
name: /Next: Simulate/,
});
await expect(nextButton).toBeEnabled();
});

test("[Use Contract Data Key] Happy path", async ({ page }) => {
Expand All @@ -1773,7 +1729,7 @@ test.describe.skip("Build Transaction Page", () => {
// Verify warning message about one operation limit
await expect(
page.getByText(
"Note that Soroban transactions can only contain one operation per transaction.",
"Soroban transaction can only contain one operation per transaction.",
),
).toBeVisible();

Expand Down Expand Up @@ -1871,27 +1827,12 @@ test.describe.skip("Build Transaction Page", () => {
.getByLabel("Resource Fee (in stroops)")
.fill("20000");

const prepareTxButton = page.getByText(
"Prepare Soroban Transaction to Sign",
);

// Mock simulate transaction RPC call
// @TODO update this after investigating restore footprint
await mockSimulateTx({
page,
responseXdr: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATiA=",
});

await expect(prepareTxButton).toBeEnabled();
await prepareTxButton.click();

// @TODO update this after investigating restore footprint
await testOpSuccessHashAndXdr({
isSorobanOp: true,
page,
hash: "aa5a5bd20265afdee0d01d36add7b9e67364516e69339313be2c174c8ee81313",
xdr: "AAAAAgAAAAANLHqVohDTxPKQ3fawTPgHahe0TzJjJkWV1WakcbeADgABu0EAD95QAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAGgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATiAAAAAA",
// In the new flow, restore_footprint does not produce XDR on
// the build step — verify the Next button is enabled (form valid).
const nextButton = page.getByRole("button", {
name: /Next: Simulate/,
});
await expect(nextButton).toBeEnabled();
});

test("[Use Contract Data Key] Validation", async ({ page }) => {
Expand Down Expand Up @@ -1989,7 +1930,7 @@ test.describe.skip("Build Transaction Page", () => {
// Verify warning message about one operation limit
await expect(
page.getByText(
"Note that Soroban transactions can only contain one operation per transaction.",
"Soroban transaction can only contain one operation per transaction.",
),
).toBeVisible();

Expand Down
Loading