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

Use SDK on dapp-kit #317

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
8 changes: 7 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
const Config = require('@vechain/repo-config');

module.exports = Config.EslintLibrary;
module.exports = {
...Config.EslintLibrary,
rules: {
...Config.EslintLibrary.rules,
'import/no-extraneous-dependencies': 'error',
},
};
51 changes: 26 additions & 25 deletions .github/workflows/lint-build-test.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
name: Lint, Build & Test

on:
push:
branches: [main]
pull_request:
branches: [main]
push:
branches: [ main-v2 ]
pull_request:

concurrency:
group: ${{ github.head_ref || github.ref_name }}-build-test-scan
cancel-in-progress: true
group: ${{ github.head_ref || github.ref_name }}-build-test-scan
cancel-in-progress: true

jobs:
build-and-test:
runs-on: ubuntu-latest
name: Lint, Build & Test
build-and-test:
runs-on: ubuntu-latest
name: Lint, Build & Test

steps:
- name: Checkout
uses: actions/checkout@v3
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: 'yarn'
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'

- name: Install
run: yarn install:all
- name: Install
run: |
yarn
yarn install:all

- name: Lint
run: yarn run lint
- name: Lint
run: yarn run lint

- name: Test
run: yarn run test
- name: Test
run: yarn run test

- name: Build
run: yarn run build
- name: Build
run: yarn run build
27 changes: 27 additions & 0 deletions .github/workflows/sonar-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: PR Sonar Scan

on:
push:
branches:
- main
pull_request:

jobs:
sonar-scan:
name: Sonar Scan
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.verbose=false
-Dsonar.branch.name=${{ github.head_ref || github.ref_name }}
71 changes: 36 additions & 35 deletions .github/workflows/test-e2e.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
name: E2E Tests

on:
push:
branches: [main]
pull_request:
branches: [main]
push:
branches: [ main-v2 ]
pull_request:

concurrency:
group: ${{ github.head_ref || github.ref_name }}-e2e-test
cancel-in-progress: true
group: ${{ github.head_ref || github.ref_name }}-e2e-test
cancel-in-progress: true

jobs:
e2e-tests:
runs-on: ubuntu-latest
name: E2E Tests

steps:
- name: Install Stable Chrome
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable

- name: Install Stable chromedriver
uses: nanasess/setup-chromedriver@v2

- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: 'yarn'

- name: Install
run: yarn install:all

- name: Run E2E Tests
run: yarn test:e2e:ci
e2e-tests:
runs-on: ubuntu-latest
name: E2E Tests

steps:
- name: Install Stable Chrome
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable

- name: Install Stable chromedriver
uses: nanasess/setup-chromedriver@v2

- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'

- name: Install
run: |
yarn
yarn install:all

- name: Run E2E Tests
run: yarn test:e2e:ci
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,14 @@ yarn-error.log*
.vscode
.parcel-cache

.reports
.reports

packages/**/dist
packages/**/.turbo
packages/**/node_modules
apps/**/dist
apps/**/.turbo
apps/**/node_modules
docs/**/dist

coverageUnit
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.20.0
v20.17.0
Binary file added .yarn/install-state.gz
Binary file not shown.
934 changes: 934 additions & 0 deletions .yarn/releases/yarn-4.5.1.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.5.1.cjs
32 changes: 16 additions & 16 deletions examples/sample-angular-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@
"watch": "ng build --watch --configuration development"
},
"dependencies": {
"@angular/animations": "^16.1.0",
"@angular/common": "^16.1.0",
"@angular/compiler": "^16.1.0",
"@angular/core": "^16.1.0",
"@angular/forms": "^16.1.0",
"@angular/localize": "^16.1.0",
"@angular/platform-browser": "^16.1.0",
"@angular/platform-browser-dynamic": "^16.1.0",
"@angular/router": "^16.1.0",
"@angular/animations": "^18.2.2",
"@angular/common": "^18.2.2",
"@angular/compiler": "^18.2.2",
"@angular/core": "^18.2.2",
"@angular/forms": "^18.2.2",
"@angular/localize": "^18.2.2",
"@angular/platform-browser": "^18.2.2",
"@angular/platform-browser-dynamic": "^18.2.2",
"@angular/router": "^18.2.2",
"@caliatys/array-typer": "^1.0.0",
"@ng-bootstrap/ng-bootstrap": "^15.0.1",
"@ngx-translate/core": "^15.0.0",
"@ngx-translate/http-loader": "^8.0.0",
"@popperjs/core": "^2.11.8",
"@vechain/dapp-kit": "*",
"@vechain/dapp-kit-ui": "*",
"@vechain/dapp-kit": "workspace:^",
"@vechain/dapp-kit-ui": "workspace:^",
"angular-svg-icon": "^16.0.0",
"assert": "2.1.0",
"axios": "^1.4.0",
Expand All @@ -46,18 +46,18 @@
"zone.js": "~0.13.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.1.0",
"@angular/cli": "^16.1.0",
"@angular/compiler-cli": "^16.1.0",
"@angular-devkit/build-angular": "^18.2.2",
"@angular/cli": "^18.2.2",
"@angular/compiler-cli": "^18.2.2",
"@types/jasmine": "~3.10.0",
"@types/node": "^12.11.1",
"@types/node": "^22.9.0",
"@vechain/repo-config": "https://github.com/vechain/repo-config#v0.0.1",
"jasmine-core": "~4.0.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.1.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.9.5"
"typescript": "5.5.4"
}
}
3 changes: 1 addition & 2 deletions examples/sample-angular-app/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Angular modules
import { NgModule } from '@angular/core';
import { Routes } from '@angular/router';
import { RouterModule } from '@angular/router';
import { type Routes, RouterModule } from '@angular/router';

const routes: Routes = [];

Expand All @@ -9,4 +8,4 @@
imports: [RouterModule.forRoot(routes, { onSameUrlNavigation: 'reload' })],
exports: [RouterModule],
})
export class AppRoutingModule {}

Check warning on line 11 in examples/sample-angular-app/src/app/app-routing.module.ts

View workflow job for this annotation

GitHub Actions / Lint, Build & Test

Unexpected empty class
8 changes: 3 additions & 5 deletions examples/sample-angular-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Angular modules
import { CUSTOM_ELEMENTS_SCHEMA, Component, type OnInit } from '@angular/core';
import { Component, CUSTOM_ELEMENTS_SCHEMA, type OnInit } from '@angular/core';
import { DAppKitUI } from '@vechain/dapp-kit-ui';

@Component({
Expand All @@ -24,13 +24,11 @@ export class AppComponent implements OnInit {
},
};

const vechainDAppKitOptions = {
DAppKitUI.configure({
nodeUrl: 'https://testnet.vechain.org/',
genesis: 'test',
walletConnectOptions,
usePersistence: true,
};
DAppKitUI.configure(vechainDAppKitOptions);
});

// custom button configuration
const customButton = document.getElementById('custom-button');
Expand Down
9 changes: 2 additions & 7 deletions examples/sample-angular-app/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
// Angular modules
import { HttpClient } from '@angular/common/http';
import { HttpClientModule } from '@angular/common/http';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DatePipe } from '@angular/common';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

// External modules
import { TranslateModule } from '@ngx-translate/core';
import { TranslateLoader } from '@ngx-translate/core';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { AngularSvgIconModule } from 'angular-svg-icon';

// Internal modules
import { AppRoutingModule } from './app-routing.module';

// Components
import { AppComponent } from './app.component';

Expand Down Expand Up @@ -49,8 +44,8 @@
],
bootstrap: [AppComponent],
})
export class AppModule {}

Check warning on line 47 in examples/sample-angular-app/src/app/app.module.ts

View workflow job for this annotation

GitHub Actions / Lint, Build & Test

Unexpected empty class

export const createTranslateLoader = (http: HttpClient) => {

Check warning on line 49 in examples/sample-angular-app/src/app/app.module.ts

View workflow job for this annotation

GitHub Actions / Lint, Build & Test

Missing return type on function
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
};
1 change: 1 addition & 0 deletions examples/sample-angular-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"target": "ES2022",
"module": "es2020",
"lib": ["es2020", "dom", "ES2021.String"],
"typeRoots": ["node_modules/@types", "../../node_modules/@types"],
"paths": {
"crypto": ["../../node_modules/crypto-browserify"],
"buffer": ["../../node_modules/buffer"],
Expand Down
8 changes: 4 additions & 4 deletions examples/sample-next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"purge": "yarn clean; rm -rf node_modules"
},
"dependencies": {
"@vechain/dapp-kit": "*",
"@vechain/dapp-kit-react": "*",
"@vechain/dapp-kit-ui": "*",
"next": "14.1.4",
"@vechain/dapp-kit": "workspace:^",
"@vechain/dapp-kit-react": "workspace:^",
"@vechain/dapp-kit-ui": "workspace:^",
"next": "15.0.3",
"react": "^18",
"react-dom": "^18"
},
Expand Down
1 change: 0 additions & 1 deletion examples/sample-next-app/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export default function RootLayout({
</head>
<body className={inter.className}>
<DAppKitProvider
genesis="test"
logLevel="DEBUG"
nodeUrl="https://testnet.vechain.org/"
usePersistence
Expand Down
3 changes: 2 additions & 1 deletion examples/sample-next-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
],
"paths": {
"@/*": ["./src/*"]
}
},
"typeRoots": ["node_modules/@types"]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
Expand Down
13 changes: 8 additions & 5 deletions examples/sample-react-app/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "sameple-react-app",
"name": "sample-react-app",
"version": "0.0.0",
"private": true,
"type": "module",
Expand All @@ -15,9 +15,12 @@
},
"dependencies": {
"@originjs/vite-plugin-commonjs": "^1.0.3",
"@vechain/dapp-kit": "*",
"@vechain/dapp-kit-react": "*",
"@vechain/dapp-kit-ui": "*",
"@vechain/dapp-kit": "workspace:^",
"@vechain/dapp-kit-react": "workspace:^",
"@vechain/dapp-kit-ui": "workspace:^",
"@vechain/sdk-core": "1.0.0-rc.1",
"@vechain/sdk-network": "1.0.0-rc.1",
"ethers": "6.13.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"vite": "^5.0.12"
Expand All @@ -33,7 +36,7 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.4",
"react-test-renderer": "^18.2.0",
"typescript": "^5.2.2",
"typescript": "5.3.3",
"vite-plugin-node-polyfills": "^0.17.0",
"vitest": "^1.2.2"
}
Expand Down
Loading
Loading