Skip to content

Commit

Permalink
Merge branch 'develop' into BLO-769
Browse files Browse the repository at this point in the history
  • Loading branch information
diegodelrieu authored Mar 7, 2023
2 parents 8c38717 + 2307e98 commit 6c01619
Show file tree
Hide file tree
Showing 57 changed files with 801 additions and 418 deletions.
8 changes: 4 additions & 4 deletions Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ We automated some parts of the release process to make things easier. This file
- Check and ensure the previous release branch `release/vX.Y.Z` was merged into `main`
- Check and ensure `main` was back-merged into `develop`
- Check and ensure you are working in the latest `develop` branch
- Run `npx lerna version` - this will:
- update the `version` in each `package.json`
- Run `yarn run version` - this will:
- update the `version` in each `package.json` and `manifest.json`
- create branch `release/vX.Y.Z`
- create tag `vX.Y.Z`
- push the tagged branch automatically
- Pushing a tagged branch triggers a release build action in GitHub
- push the branch and tag automatically
- Pushing a tag triggers a release build action in GitHub
- Wait for pipeline to create release containing the extension zip
- If the automatic npm publish failed, do it manually (ask Gerald)
- Create GitHub pull request to merge the new branch `release/vX.Y.Z` into `main`
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"packages": ["packages/*"],
"version": "5.3.5",
"version": "5.3.7",
"npmClient": "yarn",
"useWorkspaces": true
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"storybook": "cd packages/storybook && yarn storybook",
"devnet:upgrade-helper": "NODE_NO_WARNINGS=1 ts-node ./scripts/devnet-upgrade-helper.ts",
"devnet:setup-contracts": "NODE_NO_WARNINGS=1 ts-node ./scripts/devnet-setup-contracts.ts",
"version": "lerna version --no-push && yarn --cwd packages/extension run version"
"version": "lerna version --no-push --no-git-tag-version && yarn --cwd packages/extension run version"
},
"importSort": {
".js, .jsx, .ts, .tsx": {
Expand Down
6 changes: 3 additions & 3 deletions packages/dapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@argent-x/dapp",
"version": "5.3.4",
"version": "5.3.6",
"private": true,
"scripts": {
"dev": "next dev",
Expand All @@ -10,8 +10,8 @@
"lint": "next lint"
},
"dependencies": {
"@argent/get-starknet": "^5.3.4",
"@argent/x-sessions": "^5.3.4",
"@argent/get-starknet": "^5.3.6",
"@argent/x-sessions": "^5.3.6",
"ethers": "^5.5.1",
"next": "^13.0.0",
"react": "^18.0.0",
Expand Down
Binary file modified packages/extension/e2e/network-setup/dump.pkl
Binary file not shown.
5 changes: 5 additions & 0 deletions packages/extension/e2e/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@ export default {
"0x035508Aaf6C124D348686F31ca9981568F0c0d29b563a2Ecb045aA8C81334057",
],
},
{
// NOTE: Seed phrase is here intentionally and is used only for local testing. DO NOT use for any other purpose
seed: "slam water student cotton chalk okay auto police frown smart vague salon",
// 32 accounts
},
],
}
4 changes: 2 additions & 2 deletions packages/extension/e2e/src/page-objects/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export default class Account extends Navigation {
return this.page.locator('[data-testid="tokenBalance"]')
}

currentBalance(tkn: "Ether") {
return this.page.locator(`//img[@alt="${tkn}"]/parent::*/parent::button`)
currentBalance(tkn: "ETH") {
return this.page.locator(` //button//h6[contains(text(), '${tkn}')]`)
}

get accountName() {
Expand Down
26 changes: 26 additions & 0 deletions packages/extension/e2e/src/specs/recovery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,30 @@ test.describe("Recovery Wallet", () => {
await extension.navigation.yes.click()
await expect(extension.account.setUpAccountRecovery).toBeHidden()
})

test("User should be able to recover wallet with more than 30 accounts", async ({
extension,
}) => {
await extension.open()
await extension.wallet.restoreExistingWallet.click()
await extension.setClipBoardContent(config.wallets[2].seed)
await extension.paste()
await extension.navigation.continue.click()

await extension.wallet.password.fill(config.password)
await extension.wallet.repeatPassword.fill(config.password)

await extension.navigation.continue.click()
await expect(extension.wallet.finish.first()).toBeVisible({
timeout: 180000,
})

await extension.open()
await expect(extension.network.networkSelector).toBeVisible()
await extension.network.selectNetwork("Localhost 5050")
await extension.account.selectAccount("Account 32")
await expect(extension.account.currentBalance("ETH")).toContainText(
"0.9991 ETH",
)
})
})
16 changes: 8 additions & 8 deletions packages/extension/e2e/src/specs/sendFunds.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.describe("Send funds", () => {
).not.toBeVisible({
timeout: 90000,
}),
expect(extension.account.currentBalance("Ether")).not.toContainText(
expect(extension.account.currentBalance("ETH")).not.toContainText(
"1.00",
{
timeout: 90000,
Expand All @@ -49,7 +49,7 @@ test.describe("Send funds", () => {
await extension.account.token("Ethereum").click()
await expect(extension.account.balance).toContainText("1.5")
await extension.account.back.click()
await expect(extension.account.currentBalance("Ether")).toContainText("1.5")
await expect(extension.account.currentBalance("ETH")).toContainText("1.5")
})

test("send partial funds to other wallet/account", async ({
Expand Down Expand Up @@ -98,7 +98,7 @@ test.describe("Send funds", () => {
).not.toBeVisible({
timeout: 90000,
}),
expect(extension.account.currentBalance("Ether")).toContainText("0.", {
expect(extension.account.currentBalance("ETH")).toContainText("0.", {
timeout: 90000,
}),
])
Expand All @@ -108,7 +108,7 @@ test.describe("Send funds", () => {

await secondExtension.account.token("Ethereum").click()
await secondExtension.account.back.click()
await expect(secondExtension.account.currentBalance("Ether")).toContainText(
await expect(secondExtension.account.currentBalance("ETH")).toContainText(
"1.5",
)
})
Expand Down Expand Up @@ -144,7 +144,7 @@ test.describe("Send funds", () => {
).not.toBeVisible({
timeout: 90000,
}),
expect(extension.account.currentBalance("Ether")).not.toContainText(
expect(extension.account.currentBalance("ETH")).not.toContainText(
"1.00",
{
timeout: 90000,
Expand All @@ -159,7 +159,7 @@ test.describe("Send funds", () => {
await extension.account.token("Ethereum").click()
await expect(extension.account.balance).toContainText("1.9")
await extension.account.back.click()
await expect(extension.account.currentBalance("Ether")).toContainText("1.9")
await expect(extension.account.currentBalance("ETH")).toContainText("1.9")
})

test("send MAX funds to other wallet/account", async ({
Expand Down Expand Up @@ -208,7 +208,7 @@ test.describe("Send funds", () => {
).not.toBeVisible({
timeout: 90000,
}),
expect(extension.account.currentBalance("Ether")).not.toContainText(
expect(extension.account.currentBalance("ETH")).not.toContainText(
"1.00",
{
timeout: 90000,
Expand All @@ -222,7 +222,7 @@ test.describe("Send funds", () => {
await secondExtension.account.token("Ethereum").click()
await expect(secondExtension.account.balance).toContainText("1.9")
await secondExtension.account.back.click()
await expect(secondExtension.account.currentBalance("Ether")).toContainText(
await expect(secondExtension.account.currentBalance("ETH")).toContainText(
"1.9",
)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/extension/manifest/v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://json.schemastore.org/chrome-manifest.json",
"name": "Argent X",
"description": "The security of Ethereum with the scale of StarkNet",
"version": "5.3.5",
"version": "5.3.7",
"manifest_version": 2,
"browser_action": {
"default_icon": {
Expand Down
2 changes: 1 addition & 1 deletion packages/extension/manifest/v3.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://json.schemastore.org/chrome-manifest.json",
"name": "Argent X",
"description": "The security of Ethereum with the scale of StarkNet",
"version": "5.3.5",
"version": "5.3.7",
"manifest_version": 3,
"action": {
"default_icon": {
Expand Down
20 changes: 10 additions & 10 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@argent-x/extension",
"version": "5.3.5",
"version": "5.3.7",
"main": "index.js",
"license": "MIT",
"devDependencies": {
Expand Down Expand Up @@ -65,22 +65,22 @@
"test:watch": "vitest",
"test:ci": "vitest run --coverage",
"test:e2e": "playwright test",
"version": "yarn run change-to-release-branch && yarn run sync-manifest-version && yarn run commit-version-changes && yarn run push-release-branch",
"version": "yarn run change-to-release-branch && yarn run sync-manifest-version && yarn run commit-and-tag-version-changes && yarn run push-release-branch",
"change-to-release-branch": "git checkout -b release/v$npm_package_version",
"sync-manifest-version": "concurrently \"yarn sync-manifest-version:v2\" \"yarn sync-manifest-version:v3\"",
"sync-manifest-version:v2": "node -p \"JSON.stringify({...require('./manifest/v2.json'), version: '$npm_package_version'}, null, 2)\" > ./manifest/v2.temp.json && prettier --write ./manifest/v2.temp.json && mv ./manifest/v2.temp.json ./manifest/v2.json",
"sync-manifest-version:v3": "node -p \"JSON.stringify({...require('./manifest/v3.json'), version: '$npm_package_version'}, null, 2)\" > ./manifest/v3.temp.json && prettier --write ./manifest/v3.temp.json && mv ./manifest/v3.temp.json ./manifest/v3.json",
"commit-version-changes": "git add ./manifest/* && git commit -m \"chore(release): manifest v$npm_package_version\"",
"commit-and-tag-version-changes": "git add --update && git commit -m v$npm_package_version && git tag -a v$npm_package_version -m \"v$npm_package_version\"",
"push-release-branch": "git push --set-upstream origin release/v$npm_package_version --follow-tags"
},
"dependencies": {
"@argent/guardian": "^5.3.4",
"@argent/stack-router": "^5.3.4",
"@argent/ui": "^5.3.4",
"@argent/x-multicall": "^5.3.4",
"@argent/x-sessions": "^5.3.4",
"@argent/x-swap": "^5.3.4",
"@argent/x-window": "^5.3.4",
"@argent/guardian": "^5.3.6",
"@argent/stack-router": "^5.3.6",
"@argent/ui": "^5.3.6",
"@argent/x-multicall": "^5.3.6",
"@argent/x-sessions": "^5.3.6",
"@argent/x-swap": "^5.3.6",
"@argent/x-window": "^5.3.7",
"@chakra-ui/icons": "^2.0.15",
"@chakra-ui/react": "2.5.1",
"@extend-chrome/messages": "^1.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/extension/src/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ browser.runtime.onConnect.addListener((port) => {
case "SIGN_MESSAGE": {
const [message] =
await StarknetMethodArgumentsSchemas.signMessage.parseAsync([
msg.data.message,
msg.data,
])
return handleMessage([{ ...msg, data: message }, sender], port)
}
Expand Down
8 changes: 8 additions & 0 deletions packages/extension/src/background/shieldMessaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ShieldMessage } from "../shared/messages/ShieldMessage"
import {
addBackendAccount,
getBackendAccounts,
isTokenExpired,
register,
requestEmailAuthentication,
verifyEmail,
Expand Down Expand Up @@ -179,6 +180,13 @@ export const handleShieldMessage: HandleMessage<ShieldMessage> = async ({
})
}
}
case "SHIELD_IS_TOKEN_EXPIRED": {
const data = await isTokenExpired()
return sendMessageToUi({
type: "SHIELD_IS_TOKEN_EXPIRED_RES",
data,
})
}
}
throw new UnhandledMessage()
}
8 changes: 0 additions & 8 deletions packages/extension/src/shared/account/details/getEscape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Call, number } from "starknet"
import { getMulticallForNetwork } from "../../multicall"
import { getNetwork } from "../../network"
import { BaseWalletAccount } from "../../wallet.model"
import { getIsCurrentImplementation } from "./getImplementation"

/** https://github.com/argentlabs/argent-contracts-starknet/blob/main/contracts/account/library.cairo#L249-L250 */

Expand All @@ -21,13 +20,6 @@ export interface Escape {
*/

export const getEscapeForAccount = async (account: BaseWalletAccount) => {
/**
* Skip older implementations which may use 'get_escape'
*/
const isCurrent = await getIsCurrentImplementation(account)
if (!isCurrent) {
return
}
const network = await getNetwork(account.networkId)
const call: Call = {
contractAddress: account.address,
Expand Down
24 changes: 5 additions & 19 deletions packages/extension/src/shared/account/details/getGuardian.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
import { Call, constants, number, uint256 } from "starknet"

import { getMulticallForNetwork } from "../../multicall"
import { getNetwork, getProvider } from "../../network"
import { getNetwork } from "../../network"
import { BaseWalletAccount } from "../../wallet.model"
import { getIsCurrentImplementation } from "./getImplementation"

/**
* Get guardian address of account, or undefined if getGuardian returns `0x0` or account is not current implementation
* Get guardian address of account, or undefined if getGuardian returns `0x0`
*/

export const getGuardianForAccount = async (
account: BaseWalletAccount,
): Promise<string | undefined> => {
/**
* Skip older implementations which may use 'get_guardian'
*/
const isCurrent = await getIsCurrentImplementation(account)
if (!isCurrent) {
return
}
const network = await getNetwork(account.networkId)
const call: Call = {
contractAddress: account.address,
entrypoint: "getGuardian",
}
if (network.multicallAddress) {
const multicall = getMulticallForNetwork(network)
const response = await multicall.call(call)
return shapeResponse(response)
}
/** fallback to single call */
const provider = getProvider(network)
const response = await provider.callContract(call)
return shapeResponse(response.result)
const multicall = getMulticallForNetwork(network)
const response = await multicall.call(call)
return shapeResponse(response)
}

const shapeResponse = (response: string[]) => {
Expand Down
46 changes: 0 additions & 46 deletions packages/extension/src/shared/account/details/getImplementation.ts

This file was deleted.

5 changes: 5 additions & 0 deletions packages/extension/src/shared/messages/ShieldMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ export type ShieldMessage =
type: "SHIELD_CONFIRM_EMAIL_RES"
}
| { type: "SHIELD_CONFIRM_EMAIL_REJ"; data: string }
| { type: "SHIELD_IS_TOKEN_EXPIRED" }
| {
type: "SHIELD_IS_TOKEN_EXPIRED_RES"
data: boolean
}
Loading

0 comments on commit 6c01619

Please sign in to comment.