Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: token migration portal #159

Open
wants to merge 69 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
3f6ff01
feat(wip): token migration
fmorency Jan 9, 2024
08934e1
feat(wip): migration form
fmorency Jan 11, 2024
2044c9f
chore: remove poc files and fix import
fmorency Jan 11, 2024
538dc62
feat(wip): token migration)
fmorency Jan 17, 2024
6b7802a
fix: tests
fmorency Jan 17, 2024
d630665
feat(wip): token migration
fmorency Jan 17, 2024
d82dbbe
fix: asset amount
fmorency Jan 18, 2024
b18f07f
chore: code cleanup, refactor and general improvement
fmorency Jan 19, 2024
22794ec
feat(wip): token migration
fmorency Jan 23, 2024
a9dbbb5
fix(wip): token migration
fmorency Jan 24, 2024
f414867
fix(wip): token migration in menu
fmorency Jan 24, 2024
565420e
test: add basic token migration portal test
fmorency Jan 24, 2024
ea79534
chore: many-js 0.3.0
fmorency Jan 24, 2024
1ca079c
fix: import path
fmorency Jan 24, 2024
e9a1578
feat(wip): token migration
fmorency Jan 24, 2024
0ce7596
fix: warnings
fmorency Jan 25, 2024
78c36b3
fix: error handling and formatting
fmorency Jan 25, 2024
6c15de4
fix: migration details
fmorency Jan 25, 2024
9755b3e
feat(wip): token migration
fmorency Jan 25, 2024
14fbfce
feat(wip): token migration refactor and improvements
fmorency Jan 25, 2024
cd819a3
test: refactor account menu tests
fmorency Jan 26, 2024
5d64dd6
test: close toasts
fmorency Jan 29, 2024
c950c33
test: refactor account-menu
fmorency Jan 29, 2024
da40d57
test: big refactor
fmorency Jan 30, 2024
da320af
ci: bump node
fmorency Jan 30, 2024
81b6973
fix: overlapping act
fmorency Jan 30, 2024
2631df1
fix: useIsBaseBreakpoint
fmorency Jan 30, 2024
718b20b
test: bump edit and remove network timeout
fmorency Jan 30, 2024
f5cb4af
fix: import and buffer manip
fmorency Jan 31, 2024
0bb8897
test: migration-banner test
fmorency Jan 31, 2024
c8ba528
test: migration-details test
fmorency Jan 31, 2024
0aa2f99
fix: network-menu test timeout
fmorency Jan 31, 2024
cc075a5
test: migration-details error
fmorency Jan 31, 2024
b5a90ab
fix: out of bound test
fmorency Feb 1, 2024
db7ed6f
fix: build lint err
fmorency Feb 1, 2024
9fd13d3
test: migration-form
fmorency Feb 1, 2024
232341c
test: more token migration tests and fixes
fmorency Feb 2, 2024
9b3de87
chore: move mocks around
fmorency Feb 2, 2024
6b45077
fix: workaround stupid compiler
fmorency Feb 2, 2024
6714278
fix: typescript jest error
fmorency Feb 2, 2024
66aa435
test: finish account flow tests
fmorency Feb 2, 2024
7584201
test: migration-list
fmorency Feb 5, 2024
e159134
fix: refactor uuid and fix big event ids
fmorency Feb 5, 2024
3a5c712
fix: e2e tests
fmorency Feb 6, 2024
5ea6df6
test: e2e tests
fmorency Feb 7, 2024
8ade888
fix: tests
fmorency Feb 7, 2024
66408fc
fix: big number handling
fmorency Mar 12, 2024
3e48acf
Merge branch 'fix-bigint' into token-migration
fmorency Mar 12, 2024
ad3475f
Merge branch 'main' into token-migration
fmorency Mar 12, 2024
12e10fb
fix: merge
fmorency Mar 12, 2024
2d26e77
fix: use normal notation
fmorency Mar 12, 2024
54873f3
fix: event id len
fmorency Mar 13, 2024
f73fc4a
Merge remote-tracking branch 'origin/main' into token-migration
fmorency Mar 26, 2024
c8d07b7
feat: manifest chain confirmation info
fmorency Apr 3, 2024
e68956f
fix: timeout and console debug
fmorency Apr 4, 2024
39faa40
fix: bump test timeout
fmorency Apr 4, 2024
8807e88
fix: query caching issue
fmorency Apr 8, 2024
96ce485
fix: cleanup and dry
fmorency Apr 8, 2024
ca406b6
test: new chain details
fmorency Apr 12, 2024
6627bbe
chore: remove TODO
fmorency Apr 12, 2024
9f3e270
fix: migration form test
fmorency Apr 12, 2024
a986a14
chore: remove todos
fmorency Apr 12, 2024
9a300b3
chore: todo and polishing
fmorency Apr 12, 2024
374361b
fix: descriptions and confirmation checkbox
fmorency Apr 15, 2024
8c0c46b
chore: update staging talib url
fmorency Apr 23, 2024
4a3b012
Merge remote-tracking branch 'origin/main' into token-migration
fmorency Apr 30, 2024
7a3c32f
fix: enable all assets
fmorency May 2, 2024
57c81bd
fix: minimum amount
fmorency May 2, 2024
edd9e53
fix: qa talib neighborhood id
fmorency Jul 3, 2024
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
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
condition:
and:
- not:
equal: ["16.20.2", << parameters.node_version >>]
equal: ["20.9.0", << parameters.node_version >>]
steps:
# node 17+ workaround https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported
- run:
Expand All @@ -35,7 +35,7 @@ jobs:
condition:
and:
- not:
equal: ["16.20.2", << parameters.node_version >>]
equal: ["20.9.0", << parameters.node_version >>]
steps:
# node 17+ workaround https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported
- run:
Expand All @@ -54,7 +54,7 @@ jobs:
default: "RELEASE"
executor:
name: node/default
tag: "16.20.2"
tag: "20.9.0"
resource_class: large
steps:
- install-packages
Expand Down Expand Up @@ -114,7 +114,7 @@ workflows:
matrix:
parameters:
node_version:
- "16.20.2"
- "20.9.0"
- create:
name: create-<< matrix.app_env >>
matrix:
Expand Down
1 change: 1 addition & 0 deletions .env

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please change staging env talib_url to "https://qa-talib.liftedinit.app/api/v1/neighborhoods/2/" and rebuild?

Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ HTTPS=true
REACT_APP_WEB3AUTH_NETWORK=testnet
REACT_APP_WEB3AUTH_CLIENTID=BKj3lr6GfN2CnvO4CIKo5fuoCg_TpHsAPK7R8lbl6kUlz0CAH_5mFNswScEb7M6szV4hd1Tkwa2oPZ9KiXJB-44
REACT_APP_VERSION=${npm_package_version}
REACT_APP_TALIB_URL="http://localhost:3001/api/v1/neighborhoods/1/"
3 changes: 2 additions & 1 deletion .env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
REACT_APP_WEB3AUTH_NETWORK=cyan
REACT_APP_WEB3AUTH_CLIENTID=BLlqF8V3D0hLGDBfedOKvBXEZMYsdJB5kMX2GNCyXB5ZMU1enVyciGhgihBqW8E6NTaeZO182nF8zMiiMd1cAmk
REACT_APP_WEB3AUTH_CLIENTID=BLlqF8V3D0hLGDBfedOKvBXEZMYsdJB5kMX2GNCyXB5ZMU1enVyciGhgihBqW8E6NTaeZO182nF8zMiiMd1cAmk
REACT_APP_TALIB_URL="https://talib.liftedinit.app/api/v1/neighborhoods/6/"
3 changes: 2 additions & 1 deletion .env.staging
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
REACT_APP_WEB3AUTH_NETWORK=testnet
REACT_APP_WEB3AUTH_CLIENTID=BKj3lr6GfN2CnvO4CIKo5fuoCg_TpHsAPK7R8lbl6kUlz0CAH_5mFNswScEb7M6szV4hd1Tkwa2oPZ9KiXJB-44
REACT_APP_WEB3AUTH_CLIENTID=BKj3lr6GfN2CnvO4CIKo5fuoCg_TpHsAPK7R8lbl6kUlz0CAH_5mFNswScEb7M6szV4hd1Tkwa2oPZ9KiXJB-44
REACT_APP_TALIB_URL="http://localhost:3001/api/v1/neighborhoods/1/"
3 changes: 2 additions & 1 deletion e2e/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
MAIN_WALLET_PEM="-----BEGIN PRIVATE KEY-----MC4CAQAwBQYDK2VwBCIEIHcoTY2RYa48O8ONAgfxEw+15MIyqSat0/QpwA1YxiPD-----END PRIVATE KEY-----"
WALLET_1_SEED="shallow abstract tail attend public right modify awesome limb media toward other"
WALLET_2_SEED="warrior wrist okay work pave destroy coral baby blouse rhythm prepare caught"
WALLET_3_SEED="burden name asset report require crouch risk escape clutch spike gas wet"
WALLET_3_SEED="burden name asset report require crouch risk escape clutch spike gas wet"
DESTINATION_ADDRESS="manifest1q9d53rh7gq2cjq2j0nk7n0rj9qjwvnmywchg6n"
1 change: 1 addition & 0 deletions e2e/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export const mainWalletPem = process.env.MAIN_WALLET_PEM as string
export const wallet1Seed = process.env.WALLET_1_SEED as string
export const wallet2Seed = process.env.WALLET_2_SEED as string
export const wallet3Seed = process.env.WALLET_3_SEED as string
export const destinationAddress = process.env.DESTINATION_ADDRESS as string
export const FIVE_MINUTES = 300_000
22 changes: 15 additions & 7 deletions e2e/pages/home.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Locator, Page, expect } from "@playwright/test"
import { expect, Locator, Page } from "@playwright/test"

export class HomePage {
readonly url = "/#/"
Expand Down Expand Up @@ -47,8 +47,7 @@ export class HomePage {
await this.page.locator('input[name="name"]').fill(name)
await this.page.locator("button", { hasText: "Save" }).click()
await this.verifyActiveWallet(name)
const address = this.getActiveWalletAddress()
return address
return this.getActiveWalletAddress()
}

async importWalletViaPem({
Expand All @@ -66,8 +65,7 @@ export class HomePage {
await this.page.locator('textarea[name="pem"]').fill(pem)
await this.page.locator("text=Save").click()
await this.verifyActiveWallet(name)
const address = this.getActiveWalletAddress()
return address
return this.getActiveWalletAddress()
}

async importWalletViaSeed({
Expand All @@ -94,8 +92,7 @@ export class HomePage {
const saveBtn = this.page.locator("text=Save")
await saveBtn.click()
await this.verifyActiveWallet(name)
const address = this.getActiveWalletAddress()
return address
return this.getActiveWalletAddress()
}

async switchWallet(name: string) {
Expand Down Expand Up @@ -162,4 +159,15 @@ export class HomePage {
expect(title).not.toBe(null)
return title as string
}

async removeLegacyNetwork() {
await this.openNetworkMenu()
await this.page.locator('[aria-label="edit network"]').last().click()
const removeBtn = this.page.locator("data-testid=remove network button")
await expect(removeBtn).toBeDisabled()
const url = await this.page.locator('input[name="url"]').inputValue()
await this.page.locator('input[name="deleteUrl"]').fill(url as string)
await expect(removeBtn).not.toBeDisabled()
await removeBtn.click()
}
}
101 changes: 101 additions & 0 deletions e2e/pages/token-migration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { Locator, Page, expect } from "@playwright/test"

export class TokenMigration {
readonly page: Page
readonly url = "/#/token-migration-portal"
readonly createNewMigrationButton: Locator
readonly migrationHistoryButton: Locator
readonly sourceAddressSelect: Locator
readonly userAddressSelect: Locator // Only used in the Account use-case
readonly destinationAddressInput: Locator
readonly amountInput: Locator
readonly amountType: Locator
readonly nextButton: Locator

constructor(page: Page) {
this.page = page
this.createNewMigrationButton = this.page.locator(
'[aria-label="create-new-migration-btn"]',
)
this.migrationHistoryButton = this.page.locator(
'[aria-label="view-migration-history-btn"]',
)
this.sourceAddressSelect = this.page.locator(
'[aria-label="user-account-address"]',
)
this.userAddressSelect = this.page.locator('[aria-label="user-address"]')
this.destinationAddressInput = this.page.locator(
'[aria-label="destination-address"]',
)
this.amountType = this.page.locator('[aria-label="select-asset-type"]')
this.amountInput = this.page.locator('[aria-label="select-asset-amount"]')
this.nextButton = this.page.locator('[data-testid="next-btn"]')
}

async goto() {
await this.page.goto(this.url)
}

async createMigration(
from: string,
destination: string,
amount: string,
denom: string,
maybeUserAddress?: string,
) {
await this.goto()
await this.createNewMigrationButton.click()
await this.sourceAddressSelect.selectOption({
value: from,
})
await this.nextButton.click()

// Account use-case
if (from.length === 55 && maybeUserAddress !== undefined) {
await this.userAddressSelect.selectOption({
value: maybeUserAddress,
})
await this.nextButton.click()
}

await this.amountType.selectOption({ label: denom })
await this.amountInput.fill(amount)
await this.nextButton.click()

await this.destinationAddressInput.fill(destination)
await this.nextButton.click()

await this.page.waitForSelector('[data-testid="confirmation-box"]')
await this.nextButton.click()

await this.page.waitForURL("/#/token-migration-portal/migration-history/*")

return await this.page.locator('[aria-label="uuid"]').textContent()
}

async verifyMigrationInHistory(uuid: string, address: string) {
await this.goto()
await this.migrationHistoryButton.click()
await this.sourceAddressSelect.selectOption({
value: address,
})
await this.page.waitForSelector(`[aria-label="${uuid}"]`)
const uuidElement = await this.page
.locator(`[aria-label="${uuid}"]`)
.textContent()
expect(uuidElement).toBe(uuid)
}

async verifyExecutedMultiSigMigrationInHistory(
uuid: string,
address: string,
) {
await this.goto()
await this.migrationHistoryButton.click()
await this.sourceAddressSelect.selectOption({
value: address,
})
const elements = await this.page.$$(`[aria-label="${uuid}"]`)
expect(elements.length).toBe(2)
}
}
45 changes: 23 additions & 22 deletions e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,36 @@ const config: PlaywrightTestConfig = {
viewport: null,
ignoreHTTPSErrors: true,
},

projects: [
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
},
},
// {
// name: "chromium",
// use: {
// ...devices["Desktop Chrome"],
// },
// },
{
name: "firefox",
use: {
...devices["Desktop Firefox"],
},
},
{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},
{
name: "iphone12-promax",
use: {
...devices["iPhone 12 Pro Max"],
},
},
{
name: "pixel-5",
use: {
...devices["Pixel 5"],
},
},
// {
// name: "webkit",
// use: { ...devices["Desktop Safari"] },
// },
// {
// name: "iphone12-promax",
// use: {
// ...devices["iPhone 12 Pro Max"],
// },
// },
// {
// name: "pixel-5",
// use: {
// ...devices["Pixel 5"],
// },
// },
],
}
export default config
11 changes: 11 additions & 0 deletions e2e/tests/accounts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ test("submit, approve, revoke, and execute a multisig transaction", async ({
page,
}) => {
const { homePage, accountsPage } = await setup(page)

// Remove the /api/legacy network for this test as it is causing duplicate transactions listing
await homePage.openNetworkMenu()
await page.locator('[aria-label="edit network"]').last().click()
const removeBtn = page.locator("data-testid=remove network button")
expect(removeBtn).toBeDisabled()
const url = await page.locator('input[name="url"]').inputValue()
await page.locator('input[name="deleteUrl"]').fill(url as string)
expect(removeBtn).not.toBeDisabled()
await removeBtn.click()

await homePage.switchWallet("wallet1")
await accountsPage.goto()
await page.locator("text=account name").click()
Expand Down
28 changes: 23 additions & 5 deletions e2e/tests/home.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { HomePage } from "../pages/home"
let wallet1Address: string = ""
async function setup(page: Page) {
const homePage = new HomePage(page)
homePage.goto()
await homePage.goto()
wallet1Address = await homePage.importWalletViaSeed({
name: "wallet1",
seedPhrase: wallet1Seed,
Expand All @@ -18,10 +18,12 @@ async function setup(page: Page) {

test("send tokens", async ({ page }) => {
const { homePage } = await setup(page)
await homePage.verifyActiveWallet("main")
const symbol = "MFX"
const startAmount = await page
let startAmount = await page
.locator(`[aria-label="${symbol} amount"]`)
.textContent()
startAmount = (startAmount as string).replace(/,/g, "")
await homePage.sendToken({
toAddress: wallet1Address,
symbol,
Expand Down Expand Up @@ -82,15 +84,31 @@ test("add a network", async ({ page }) => {
test("edit a network", async ({ page }) => {
const { homePage } = await setup(page)
await homePage.openNetworkMenu()
await page.locator('[aria-label="edit network"]').first().click()
await homePage.addNetworkButton.click()
await page.locator('input[name="name"]').fill("new-network")
await page.locator('input[name="url"]').fill("/new-api")
await page.locator("text=save").click()
const networkName = await homePage.networkMenuTrigger.textContent()
expect(networkName).toBe("new-network")

await homePage.openNetworkMenu()
await page.locator('[aria-label="edit network"]').first().click()
await page.locator('input[name="name"]').fill("new-network2")
await page.locator("text=save").click()
const networkName2 = await homePage.networkMenuTrigger.textContent()
expect(networkName2).toBe("new-network2")
})

test("remove a network", async ({ page }) => {
const { homePage } = await setup(page)
await homePage.openNetworkMenu()
await homePage.addNetworkButton.click()
await page.locator('input[name="name"]').fill("new-network")
await page.locator('input[name="url"]').fill("/new-api")
await page.locator("text=save").click()
const networkName = await homePage.networkMenuTrigger.textContent()
expect(networkName).toBe("new-network")

await homePage.openNetworkMenu()
await page.locator('[aria-label="edit network"]').first().click()
const removeBtn = page.locator("data-testid=remove network button")
Expand All @@ -100,6 +118,6 @@ test("remove a network", async ({ page }) => {
await page.locator('input[name="deleteUrl"]').fill(url as string)
expect(removeBtn).not.toBeDisabled()
await removeBtn.click()
const networkName = await homePage.networkMenuTrigger.textContent()
expect(networkName).not.toBe(name)
const networkName2 = await homePage.networkMenuTrigger.textContent()
expect(networkName2).not.toBe(name)
})
Loading