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

x-sessions update #23

Merged
merged 105 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
92de0c1
e2e poc
canlopes Nov 12, 2024
fa81906
poc e2e
canlopes Nov 12, 2024
c024d15
fix
canlopes Nov 12, 2024
f64a08d
fix
canlopes Nov 12, 2024
24f8fee
fix
canlopes Nov 12, 2024
f3a0dcf
fix
canlopes Nov 12, 2024
d43e4a4
fix
canlopes Nov 12, 2024
93ddaeb
up
canlopes Nov 12, 2024
289cbc9
up
canlopes Nov 13, 2024
91d6602
up
canlopes Nov 13, 2024
1f9474a
up
canlopes Nov 13, 2024
2d31db6
up
canlopes Nov 15, 2024
64af238
Merge remote-tracking branch 'origin/develop' into tests/e2e-POC
canlopes Nov 15, 2024
9d171fe
up
canlopes Nov 15, 2024
00cc01e
use argent-x prod build
canlopes Nov 22, 2024
23f7eb3
test:webwallet
canlopes Nov 25, 2024
7b14a02
Merge remote-tracking branch 'origin/develop' into tests/e2e-POC
canlopes Nov 25, 2024
afa9cc5
fix
canlopes Nov 25, 2024
606c3c2
fix
canlopes Nov 25, 2024
920138f
fix
canlopes Nov 25, 2024
1303cae
log
canlopes Nov 25, 2024
45bc399
uo
canlopes Nov 25, 2024
dcd12ab
up
canlopes Nov 26, 2024
68ad38f
Merge remote-tracking branch 'origin/develop' into tests/e2e-POC
canlopes Nov 26, 2024
00ea980
up
canlopes Nov 26, 2024
3e975e6
fix
canlopes Nov 26, 2024
a97ec4f
fix
canlopes Nov 26, 2024
ae71e2b
up
canlopes Nov 26, 2024
852f1e8
up
canlopes Nov 26, 2024
aa66a07
fix
canlopes Nov 26, 2024
b70119a
fix
canlopes Nov 26, 2024
c90f111
up
canlopes Nov 26, 2024
8b8b566
chore: update ui
bluecco Nov 28, 2024
f7eaab5
feat: enable mm support
khanti42 Dec 2, 2024
cfb9487
chore: rollback pnpm-lock.yaml
khanti42 Dec 4, 2024
72fb72a
chore: bump starknekit version
khanti42 Dec 4, 2024
3706f69
chore: add get-starknet-core dep
khanti42 Dec 4, 2024
f1d816b
Merge pull request #11 from khanti42/feat/mm-support
bluecco Dec 4, 2024
e271106
Merge branch 'develop' into tests/e2e-POC
bluecco Dec 5, 2024
1d34fb1
chore: ignore e2e node modules
bluecco Dec 5, 2024
3f52234
chore: ignore e2e node modules
bluecco Dec 5, 2024
1f72402
Merge pull request #7 from argentlabs/tests/e2e-POC
bluecco Dec 5, 2024
ded08a9
chore: webwallet e2e test for tx and sign
bluecco Dec 6, 2024
bc249ae
chore: update config for webwallet
bluecco Dec 6, 2024
7787587
chore: use test pin
bluecco Dec 6, 2024
072602c
chore: restore email client
bluecco Dec 6, 2024
6be9238
fix: pull-request.yml
bluecco Dec 6, 2024
574f407
chore: add debug console.log for tests
bluecco Dec 6, 2024
2a8cc2f
chore: add debug console.log for tests
bluecco Dec 6, 2024
b7b3eaa
chore: add debug console.log for tests
bluecco Dec 6, 2024
89adeb7
chore: add debug console.log for tests
bluecco Dec 6, 2024
588132c
chore: await for popup or iframe
bluecco Dec 6, 2024
8458a66
chore: force test environment
bluecco Dec 9, 2024
44a63fc
chore: force test environment
bluecco Dec 9, 2024
dd1f25d
chore: force test environment
bluecco Dec 9, 2024
c54f0fc
chore: update ui
bluecco Dec 9, 2024
77890a5
Merge branch 'develop' into WT-141
bluecco Dec 9, 2024
5093769
tests: fix tests
canlopes Dec 9, 2024
9c41721
Merge branch 'WT-141' of github.com:argentlabs/demo-dapp-starknet int…
canlopes Dec 9, 2024
143fe42
chore: remove test environment
bluecco Dec 9, 2024
4c2b779
tests: fix tests
canlopes Dec 9, 2024
62ed04e
Merge branch 'WT-141' of github.com:argentlabs/demo-dapp-starknet int…
canlopes Dec 9, 2024
feea8f8
fix: webwallet tests
bluecco Dec 11, 2024
49e50d5
chore: add logs
bluecco Dec 11, 2024
649dbba
Merge pull request #12 from argentlabs/WT-141
bluecco Dec 11, 2024
b5f3a44
chore: update e2e tests
bluecco Dec 11, 2024
1dc4406
Merge pull request #13 from argentlabs/WW-143
bluecco Dec 11, 2024
712578e
chore: add argent-x tests for signMessage and transaction
bluecco Dec 12, 2024
99f7561
fix: ax tests
bluecco Dec 12, 2024
94ce6c2
chore: add network tests for ax
bluecco Dec 12, 2024
34aed94
chore: add network tests for ax
bluecco Dec 12, 2024
7e0b4bc
chore: update ax e2e tests
bluecco Dec 13, 2024
cc6ba87
tests: add missing env var
canlopes Dec 13, 2024
42de919
fix
canlopes Dec 13, 2024
73df92c
tests: download argentX only once
canlopes Dec 13, 2024
3e91a34
chore: update transaction tests for ax
bluecco Dec 13, 2024
1a4b3c5
fix
canlopes Dec 13, 2024
f52d9ea
Merge branch 'ax0-tests-sign-and-tx' of github.com:argentlabs/demo-da…
canlopes Dec 13, 2024
ef84b53
Merge pull request #14 from argentlabs/ax0-tests-sign-and-tx
bluecco Dec 13, 2024
aefc72a
chore: refactor abi
bluecco Dec 17, 2024
e3587cf
chore: refactor helpers
bluecco Dec 17, 2024
38ee688
chore: update x-sessions
bluecco Dec 17, 2024
cf2a0bc
refactor: types, sessionHelper and transfer components
bluecco Dec 17, 2024
d67894c
feat: session keys sign and execute
bluecco Dec 17, 2024
24dd02a
feat: execute from outside components and logic
bluecco Dec 17, 2024
91205ce
fix: build
bluecco Dec 17, 2024
6d4fff4
chore: add e2e
bluecco Dec 17, 2024
db01a9b
chore: e2e tests
bluecco Dec 18, 2024
6ad2fc3
chore: use sepolia-web for e2e webwallet
bluecco Dec 18, 2024
e8330fc
chore: use sepolia-web for e2e webwallet
bluecco Dec 18, 2024
d96b7b5
chore: use sepolia-web for e2e webwallet
bluecco Dec 18, 2024
68fcd8b
chore: force sepolia on webwallet e2e
bluecco Dec 18, 2024
8dabb45
chore: force sepolia on webwallet e2e
bluecco Dec 18, 2024
b8e2916
chore: initialize to sepolia web
bluecco Dec 18, 2024
44f7f25
fix: test and mainnet session keys logic
bluecco Dec 18, 2024
f96a482
chore: fix e2e test
bluecco Dec 18, 2024
f347fff
fix: e2e test
bluecco Dec 18, 2024
90170b0
chore: update e2e
bluecco Dec 18, 2024
0abc0a0
fix: e2e
bluecco Dec 18, 2024
186f5a0
chore: fix mobile connect button
bluecco Dec 19, 2024
8555103
fix: session keys
bluecco Dec 23, 2024
736a9db
Merge pull request #15 from argentlabs/feat/session-keys
bluecco Dec 23, 2024
7feb03d
chore: update readme
bluecco Dec 23, 2024
65c0ca5
Merge pull request #19 from argentlabs/fix/readme
bluecco Dec 23, 2024
e882358
chore: update package.json
bluecco Dec 23, 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
193 changes: 192 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,26 @@ on:
- develop
- main
pull_request:
env:
PNPM_VERSION: 9.1.4
NODE_VERSION: 20.x

jobs:
build:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.48.2-jammy
env:
ARGENT_X_ENVIRONMENT: "hydrogen"
E2E_REPO: ${{ secrets.E2E_REPO }}
E2E_REPO_TOKEN: ${{ secrets.E2E_REPO_TOKEN }}
E2E_REPO_OWNER: ${{ secrets.E2E_REPO_OWNER }}
E2E_REPO_RELEASE_NAME: ${{ secrets.E2E_REPO_RELEASE_NAME }}

WW_EMAIL: ${{ secrets.WW_EMAIL }}
WW_LOGIN_PASSWORD: ${{ secrets.WW_LOGIN_PASSWORD }}
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }}

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -18,8 +34,13 @@ jobs:
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
# version: 9
run_install: false
version: ${{ env.PNPM_VERSION }}

- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"

- name: Get pnpm store directory
shell: bash
Expand All @@ -36,5 +57,175 @@ jobs:

- name: Install dependencies
run: pnpm install

- name: Build demo-dapp-starknet
run: pnpm run build

- name: Use Cache
uses: actions/cache@v4
with:
path: ./*
key: ${{ github.sha }}

test-webwallet:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.48.2-jammy
needs: [build]
env:
ARGENT_X_ENVIRONMENT: "hydrogen"

WW_EMAIL: ${{ secrets.WW_EMAIL }}
WW_LOGIN_PASSWORD: ${{ secrets.WW_LOGIN_PASSWORD }}
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }}

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: ${{ env.PNPM_VERSION }}
run_install: false

- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"

- name: Restore pnpm cache
uses: actions/cache/restore@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Restore cached build
uses: actions/cache/restore@v4
with:
path: ./*
key: ${{ github.sha }}

- name: Run e2e tests
run: |
pnpm run start & # Start the server in background
echo "Waiting for server to be ready..."
for i in $(seq 1 30); do
if curl -s http://localhost:3000 > /dev/null; then
echo "Server is ready!"
break
fi
echo "Attempt $i: Server not ready yet..."
if [ $i -eq 30 ]; then
echo "Server failed to start"
exit 1
fi
sleep 1
done
xvfb-run --auto-servernum pnpm test:webwallet

- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: test-artifacts
path: |
e2e/artifacts/playwright/
!e2e/artifacts/playwright/*.webm
retention-days: 5

test-argentX:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.48.2-jammy
needs: [build]
env:
ARGENT_X_ENVIRONMENT: "hydrogen"
E2E_REPO: ${{ secrets.E2E_REPO }}
E2E_REPO_TOKEN: ${{ secrets.E2E_REPO_TOKEN }}
E2E_REPO_OWNER: ${{ secrets.E2E_REPO_OWNER }}
E2E_REPO_RELEASE_NAME: ${{ secrets.E2E_REPO_RELEASE_NAME }}
E2E_TESTNET_SEED3: ${{ secrets.E2E_TESTNET_SEED3 }}

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: ${{ env.PNPM_VERSION }}
run_install: false

- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"

- name: Restore pnpm cache
uses: actions/cache/restore@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Restore cached build
uses: actions/cache/restore@v4
with:
path: ./*
key: ${{ github.sha }}

- name: Install libarchive-tools
shell: bash
run: |
try_apt() {
rm -f /var/lib/apt/lists/lock
rm -f /var/cache/apt/archives/lock
rm -f /var/lib/dpkg/lock*
dpkg --configure -a
apt-get update && apt-get install -y libarchive-tools
}

for i in $(seq 1 3); do
echo "Attempt $i to install libarchive-tools"
if try_apt; then
echo "Successfully installed libarchive-tools"
exit 0
fi
echo "Attempt $i failed, waiting 10 seconds..."
sleep 10
done

echo "Failed to install libarchive-tools after 3 attempts"
exit 1

- name: Run e2e tests
run: |
pnpm run start & # Start the server in background
echo "Waiting for server to be ready..."
for i in $(seq 1 30); do
if curl -s http://localhost:3000 > /dev/null; then
echo "Server is ready!"
break
fi
echo "Attempt $i: Server not ready yet..."
if [ $i -eq 30 ]; then
echo "Server failed to start"
exit 1
fi
sleep 1
done
xvfb-run --auto-servernum pnpm test:argentx

- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: test-artifacts
path: |
e2e/artifacts/playwright/
!e2e/artifacts/playwright/*.webm
retention-days: 5
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,10 @@ next-env.d.ts
.playwright-*
playwright-report*

.eslintcache
.eslintcache
artifacts
argent-x-dist

/e2e/node_modules/

settings.json
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# demo-dapp-starknet

This dapp is used as an example for integrating [Starknetkit](https://github.com/argentlabs/starknetkit) with [Starknet-react][https://github.com/apibara/starknet-react].

This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started
Expand Down
86 changes: 86 additions & 0 deletions e2e/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import path from "path"
import dotenv from "dotenv"
import fs from "fs"

const envPath = path.resolve(__dirname || "", ".env")
if (fs.existsSync(envPath)) {
dotenv.config({ path: envPath })
}
const commonConfig = {
isProdTesting: process.env.ARGENT_X_ENVIRONMENT === "prod" ? true : false || "",
password: "MyP@ss3!",
//accounts used for setup
senderAddrs: process.env.E2E_SENDER_ADDRESSES?.split(",") || "",
senderKeys: process.env.E2E_SENDER_PRIVATEKEYS?.split(",") || "",
destinationAddress: process.env.E2E_SENDER_ADDRESSES?.split(",")[0] ||"", //used as transfers destination
// urls
rpcUrl: process.env.ARGENT_SEPOLIA_RPC_URL || "",
beAPIUrl:
process.env.ARGENT_X_ENVIRONMENT === "prod"
? ""
: process.env.ARGENT_API_BASE_URL || "",
viewportSize: { width: 360, height: 800 },
artifactsDir: path.resolve(__dirname, "./artifacts/playwright"),
isCI: Boolean(process.env.CI),
migDir: path.join(__dirname, "../../e2e/argent-x-dist/"),
distDir: path.join(__dirname, "../../extension/dist/"),
migVersionDir: path.join(__dirname || "", "../../e2e/argent-x-dist/dist"),
migRepo: process.env.E2E_REPO || "",
migRepoToken: process.env.E2E_REPO_TOKEN || "",
migRepoOwner: process.env.E2E_REPO_OWNER || "",
migReleaseName: process.env.E2E_REPO_RELEASE_NAME || "",
}

const extensionHydrogenConfig = {
...commonConfig || "",
testSeed1: process.env.E2E_TESTNET_SEED1 || "", //wallet with 33 regular deployed accounts and 1 multisig deployed account
testSeed3: process.env.E2E_TESTNET_SEED3 || "", //wallet with 1 deployed account|| "", and multisig with removed user
testSeed4: process.env.E2E_TESTNET_SEED4 || "", //wallet with non deployed account but with funds
senderSeed: process.env.E2E_SENDER_SEED || "",
account1Seed2: process.env.E2E_ACCOUNT_1_SEED2 || "",
spokCampaignName: process.env.E2E_SPOK_CAMPAIGN_NAME || "",
spokCampaignUrl: process.env.E2E_SPOK_CAMPAIGN_URL || "",
guardianEmail: process.env.E2E_GUARDIAN_EMAIL || "",
useStrkAsFeeToken: process.env.E2E_USE_STRK_AS_FEE_TOKEN || "",
skipTXTests: process.env.E2E_SKIP_TX_TESTS || "",
accountsToImport: process.env.E2E_ACCOUNTS_TO_IMPORT || "",
accountToImportAndTx: process.env.E2E_ACCOUNT_TO_IMPORT_AND_TX?.split(",") || "",
qaUtilsURL: process.env.E2E_QA_UTILS_URL || "",
qaUtilsAuthToken: process.env.E2E_QA_UTILS_AUTH_TOKEN || "",
initialBalanceMultiplier: process.env.INITIAL_BALANCE_MULTIPLIER || 1 || "",
migAccountAddress: process.env.E2E_MIG_ACCOUNT_ADDRESS || "",
}

const extensionProdConfig = {
...commonConfig,
testSeed1: process.env.E2E_MAINNET_SEED1 || "",
testSeed3: "",
testSeed4: "",
senderSeed: process.env.E2E_SENDER_SEED || "",
account1Seed2:"",
account1Seed3:"",
spokCampaignName:"",
spokCampaignUrl:"",
guardianEmail:"",
useStrkAsFeeToken: "false",
skipTXTests: "true",
accountsToImport:"",
accountToImportAndTx:"",
qaUtilsURL:"",
qaUtilsAuthToken:"",
initialBalanceMultiplier: 1,
migAccountAddress:"",
migVersions:"",
}

const config = commonConfig.isProdTesting
? extensionProdConfig
: extensionHydrogenConfig
// check that no value of config is undefined|| "", otherwise throw error
Object.entries(config).forEach(([key, value]) => {
if (value === undefined) {
throw new Error(`Missing ${key} config variable; check .env file`)
}
})

export default config
41 changes: 41 additions & 0 deletions e2e/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "@demo-dapp-starket/e2e",
"private": true,
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"peerDependencies": {
"@scure/base": "^1.1.1",
"@scure/bip39": "^1.2.1",
"axios": "^1.7.7",
"fs-extra": "^11.2.0",
"lodash-es": "^4.17.21",
"object-hash": "^3.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"swr": "^1.3.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@playwright/test": "^1.48.1",
"@types/axios": "^0.14.0",
"@types/fs-extra": "^11.0.4",
"@types/imap-simple": "^4.2.9",
"@types/mailparser": "^3.4.5",
"@types/node": "^22.0.0",
"@types/nodemailer": "^6.4.17",
"@types/uuid": "^10.0.0",
"dotenv": "^16.3.1",
"starknet": "6.11.0",
"uuid": "^11.0.0"
},
"scripts": {
"test:argentx": "DONWNLOAD_ARGENTX_BUILD=1 pnpm playwright test --project=ArgentX",
"test:webwallet": "pnpm playwright test --project=WebWallet"
},
"dependencies": {
"imap-simple": "^5.1.0",
"mailparser": "^3.7.1",
"nodemailer": "^6.9.16"
}
}
Loading
Loading