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

0.0.0-alpha.10 #56

Open
wants to merge 69 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
69bb844
Sign message (#18)
arhtudormorar Aug 30, 2024
e098464
add todos
CiprianDraghici Sep 4, 2024
333db0b
Restore provider (#19)
arhtudormorar Sep 6, 2024
2b77ed7
Merge remote-tracking branch 'refs/remotes/origin/development' into c…
CiprianDraghici Sep 6, 2024
5cb04b6
update packages and add TODO
CiprianDraghici Sep 6, 2024
b89cc1e
Sign, send and track transactions (#21)
arhtudormorar Sep 16, 2024
de787de
Work on ledger provider
arhtudormorar Sep 16, 2024
d210306
Project building
arhtudormorar Sep 17, 2024
1236242
Signing with leder working
arhtudormorar Sep 17, 2024
4b6d84b
update packages
CiprianDraghici Sep 17, 2024
96ab412
Merge remote-tracking branch 'origin/development' into cd/feature/sta…
CiprianDraghici Sep 17, 2024
49bcab1
fix build
CiprianDraghici Sep 17, 2024
c2c1fa5
update signMessage method and add TODOs for next steps
CiprianDraghici Sep 17, 2024
7064b57
Upgrade packages
arhtudormorar Sep 19, 2024
cfcb9f3
Remove unused
arhtudormorar Sep 19, 2024
7502e92
Merge branch 'cd/feature/standardize-providers' into tm/ledger-provider
arhtudormorar Sep 19, 2024
d461db4
Update yarn lock
arhtudormorar Sep 19, 2024
aedb8d3
Try alpha 1
arhtudormorar Sep 19, 2024
aa4857b
Upgrade cwp
arhtudormorar Sep 19, 2024
28343a5
Added jest types
arhtudormorar Sep 19, 2024
3479319
Fix guardian signing
arhtudormorar Sep 19, 2024
80c0df2
Standardize providers (#20)
CiprianDraghici Sep 19, 2024
fd8a408
Upgrade ledger
arhtudormorar Sep 19, 2024
e03790e
Merge development
arhtudormorar Sep 19, 2024
b738791
Resolve comments
arhtudormorar Sep 20, 2024
0e4d9b2
Separate react store from main store
arhtudormorar Sep 23, 2024
8ce464a
Upgrade empty provider
arhtudormorar Sep 23, 2024
4e1420f
Remove callbackRoute from signMessage and upgrade to Message
arhtudormorar Sep 23, 2024
ad4c2ef
Revert version
arhtudormorar Sep 23, 2024
71b0463
Merge pull request #25 from multiversx/tm/ledger-provider
arhtudormorar Sep 23, 2024
6009b8e
Update CHANGELOG
arhtudormorar Sep 23, 2024
5df6cbc
Integrate extension provider
arhtudormorar Sep 25, 2024
2eb4a6c
Update CHANGELOG
arhtudormorar Sep 25, 2024
3a160bd
Merge pull request #26 from multiversx/tm/integrate-extension
arhtudormorar Sep 25, 2024
695d294
Integrate Metamask (#27)
arhtudormorar Oct 11, 2024
5366f50
Fix verify message
arhtudormorar Oct 29, 2024
512e91a
Integrate passkeys-proxy (#29)
arhtudormorar Nov 6, 2024
20e214a
Ledger UI (#32)
arhtudormorar Nov 26, 2024
0a43961
Lint project (#33)
arhtudormorar Nov 26, 2024
3472ec1
Update ledger communication (#34)
arhtudormorar Nov 27, 2024
fbd76e9
Added custom web socket url support (#35)
DanutIlie Nov 28, 2024
7f8ed37
Stencil webcomponents from sdk-dapp-core-ui (#37)
arhtudormorar Dec 3, 2024
660fb1c
Create provider (#39)
arhtudormorar Dec 5, 2024
15c1972
Fix create provider (#40)
arhtudormorar Dec 6, 2024
6c5da6e
Fix init native auth (#42)
arhtudormorar Dec 6, 2024
37cc8fd
Added transaction manager (#41)
DanutIlie Dec 9, 2024
563bb18
Add WalletConnect Provider (#45)
mgavrila Dec 11, 2024
bf22909
Make ui version fixed
arhtudormorar Dec 12, 2024
6d6cfc5
Tm/feature/sign screens proposal (#47)
arhtudormorar Dec 13, 2024
8a312d4
Add provider strategy (#46)
mgavrila Dec 16, 2024
699ebc7
Organize project structure (#49)
mgavrila Dec 17, 2024
6210a1a
Transactions pending screen (#48)
mgavrila Dec 19, 2024
7930928
Replace window with safeWindow
mgavrila Dec 19, 2024
41db8a7
Merge pull request #50 from multiversx/rt/feature/dapp-template
razvantomegea Dec 19, 2024
e05ccd8
Added transactions helpers (#52)
razvantomegea Dec 19, 2024
5d746e7
added transaction tracking (#51)
DanutIlie Dec 20, 2024
31c6ed4
added transaction toasts (#53)
DanutIlie Dec 20, 2024
079d116
Tm/feature/sign steps (#54)
arhtudormorar Dec 23, 2024
29e61db
Transaction interpretation helpers (#55)
razvantomegea Dec 23, 2024
b3d6b94
Upgrade @multiversx/sdk-dapp-core-ui
arhtudormorar Dec 24, 2024
5ebb1d2
Update getTransactionsByHashes.ts
arhtudormorar Dec 24, 2024
66aea0d
Update eventbus types
arhtudormorar Dec 24, 2024
7587052
Remove unused
arhtudormorar Dec 24, 2024
b60cc7f
Rename signTransactions
arhtudormorar Dec 24, 2024
3fa4774
Remove init route
arhtudormorar Dec 24, 2024
25fc7a4
Replace SmartContractResult with ResultType
arhtudormorar Dec 24, 2024
7e9b469
Refactors
arhtudormorar Dec 24, 2024
ac09af2
Merge branch 'development' into tm/updates/linting
arhtudormorar Dec 24, 2024
a5a14db
Merge pull request #57 from multiversx/tm/updates/linting
arhtudormorar Dec 24, 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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ node_modules
.cache
*.log
.DS_Store
**/.DS_Store

# builds
build
Expand All @@ -18,7 +19,6 @@ out
.husky

# misc
.DS_Store
.env
.env.local
.env.development.local
Expand All @@ -29,5 +29,5 @@ out
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.yarnrc
coverage
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [[0.0.0-alpha.10](https://github.com/multiversx/mx-sdk-dapp-core/pull/56)] - 2024-12-23

- [Added transactions interpretation helpers](https://github.com/multiversx/mx-sdk-dapp-core/pull/55)
- [Added transaction toasts](https://github.com/multiversx/mx-sdk-dapp-core/pull/53)
- [Added transactions helpers](https://github.com/multiversx/mx-sdk-dapp-core/pull/52)
- [Added transactions tracking](https://github.com/multiversx/mx-sdk-dapp-core/pull/51)
- [Added provider constants and getTransactions API call](https://github.com/multiversx/mx-sdk-dapp-core/pull/50)
- [Added pending transactions](https://github.com/multiversx/mx-sdk-dapp-core/pull/48)
- [Added transaction manager](https://github.com/multiversx/mx-sdk-dapp-core/pull/41)
- [Added custom web socket url support](https://github.com/multiversx/mx-sdk-dapp-core/pull/35)
- [Metamask integration](https://github.com/multiversx/mx-sdk-dapp-core/pull/27)
- [Extension integration](https://github.com/multiversx/mx-sdk-dapp-core/pull/26)
- [Ledger integration](https://github.com/multiversx/mx-sdk-dapp-core/pull/22)
- [Added sign, send, & track transactions with websocket connection](https://github.com/multiversx/mx-sdk-dapp-core/pull/21)
- [Added restore provider after page reload](https://github.com/multiversx/mx-sdk-dapp-core/pull/19)
- [Added signMessage](https://github.com/multiversx/mx-sdk-dapp-core/pull/18)

## [[0.0.0-alpha.9]](https://github.com/multiversx/mx-sdk-dapp-core)] - 2024-08-29

- [CrossWindow login](https://github.com/multiversx/mx-sdk-dapp-core/pull/13)

## [[v0.0.0-alpha.8]](https://github.com/multiversx/mx-sdk-dapp-core/pull/16) - 2024-08-27

- [Added sdk-web-wallet-cross-window-provider as peer dependency](https://github.com/multiversx/mx-sdk-dapp-core/pull/14)
- [Generic login + ExtensionProvider login](https://github.com/multiversx/mx-sdk-dapp-core/pull/12)
- [Make middlewares registration more scalable](https://github.com/multiversx/mx-sdk-dapp-core/pull/11)
Expand Down
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,41 @@

## Usage

In your project, make sure to use the `preserveSymlinks` option in the server configuration to ensure that the symlinks are preserved, for ease of development.

``` js
resolve: {
preserveSymlinks: true, // 👈
alias: {
src: "/src",
},
},
```

// TODO: DEMONSTRATE API


```mermaid
flowchart TB;
id1{index.tsx}

-- sdk-dpp-core config -->

F(
persistance
network
custom providers
)

-- await config -->

id2{/unlock}

-- user presses login -->

Provider.login

-- redirect -->

/dashboard
```
67 changes: 42 additions & 25 deletions eslint.config.js → eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
[
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import importPlugin from 'eslint-plugin-import';
import prettierPlugin from 'eslint-plugin-prettier';
import jestPlugin from 'eslint-plugin-jest';

/** @type {import('eslint').Linter.Config[]} */
export default [
{
env: {
es2021: true,
node: true
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
ecmaFeatures: {
jsx: true
files: ['**/*.{js,mjs,cjs,ts,tsx}', '**/*.{test,spec}.{js,ts,tsx}'],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.jest
},
project: './tsconfig.json'
parser: tseslint.parser,
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
ecmaFeatures: {
jsx: true
},
project: './tsconfig.json'
}
},
plugins: {
import: importPlugin,
prettier: prettierPlugin,
jest: jestPlugin,
'@typescript-eslint': tseslint.plugin
},
settings: {
'import/parsers': {
Expand All @@ -27,13 +45,10 @@
}
}
},
extends: [
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended'
],
plugins: ['prettier', 'import'],
rules: {
...jestPlugin.configs.recommended.rules,
...pluginJs.configs.recommended.rules,
...tseslint.configs.recommended.rules,
'import/order': [
'warn',
{
Expand All @@ -52,12 +67,7 @@
}
}
],
'prettier/prettier': [
'error',
{
endOfLine: 'lf'
}
],
'prettier/prettier': ['error', { endOfLine: 'lf' }],
'@typescript-eslint/indent': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-use-before-define': [
Expand All @@ -68,13 +78,20 @@
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' }
{
argsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
],
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'always'],
'no-unused-vars': ['off'],
'no-prototype-builtins': 'off',
'jest/no-mocks-import': 'off',
'no-async-promise-executor': 'off',
'object-curly-newline': 'off',
'arrow-body-style': 'off',
'implicit-arrow-linebreak': 'off',
Expand Down
71 changes: 42 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiversx/sdk-dapp-core",
"version": "0.0.0-alpha.9",
"version": "0.0.0-alpha.10",
"main": "out/index.js",
"module": "out/index.js",
"types": "out/index.d.ts",
Expand All @@ -19,74 +19,87 @@
"url": "git+https://github.com/multiversx/mx-sdk-dapp-core.git"
},
"scripts": {
"unpublish-verdaccio": "npm unpublish @multiversx/sdk-dapp-core --force --registry http://localhost:4873",
"publish-verdaccio": "npm run unpublish-verdaccio && npm run compile-next && npm publish --registry http://localhost:4873/",
"compile": "tsc && tsc-alias",
"build-esbuild": "rimraf out && node esbuild.js",
"publish-verdaccio": "npm unpublish --registry http://localhost:4873 @multiversx/sdk-dapp-core@0.0.0-alpha.3 && rimraf out && yarn compile && npm publish --registry http://localhost:4873",
"build": "yarn build-esbuild && yarn compile",
"test": "jest",
"lint": "eslint --fix src",
"compile-next": "rimraf out && tsc --p tsconfig.next.json && tsc-alias --project tsconfig.next.json"
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@lifeomic/axios-fetch": "3.0.1",
"@multiversx/sdk-extension-provider": "3.0.0",
"@multiversx/sdk-hw-provider": "6.4.0",
"@multiversx/sdk-metamask-provider": "0.0.5",
"@multiversx/sdk-core": ">= 13.5.0",
"@multiversx/sdk-dapp-utils": ">= 1.0.2",
"@multiversx/sdk-extension-provider": "4.0.0",
"@multiversx/sdk-hw-provider": "7.0.0",
"@multiversx/sdk-metamask-provider": "1.0.0",
"@multiversx/sdk-native-auth-client": "^1.0.8",
"@multiversx/sdk-opera-provider": "1.0.0-alpha.1",
"@multiversx/sdk-wallet-connect-provider": "4.1.2",
"@multiversx/sdk-wallet": "4.5.1",
"@multiversx/sdk-wallet-connect-provider": "5.0.1",
"@multiversx/sdk-web-wallet-cross-window-provider": ">= 2.0.4",
"@multiversx/sdk-web-wallet-iframe-provider": "2.0.1",
"@multiversx/sdk-web-wallet-provider": "3.2.1",
"@types/lodash": "^4.17.4",
"isomorphic-fetch": "^3.0.0",
"lodash": "^4.17.21",
"zustand": "^4.4.7"
"isomorphic-fetch": "3.0.0",
"lodash": "4.17.21",
"protobufjs": "7.3.0",
"socket.io-client": "4.7.5",
"zustand": "4.4.7"
},
"peerDependencies": {
"@multiversx/sdk-core": ">= 13.0.0",
"@multiversx/sdk-dapp-utils": ">= 0.1.0",
"@multiversx/sdk-web-wallet-cross-window-provider": ">= 1.0.0",
"@multiversx/sdk-core": ">= 13.5.0",
"@multiversx/sdk-dapp-utils": ">= 1.0.2",
"@multiversx/sdk-web-wallet-cross-window-provider": ">= 2.0.4",
"axios": ">=1.6.5",
"bignumber.js": "9.x"
"bignumber.js": "9.x",
"immer": "10.x"
},
"optionalDependencies": {
"@multiversx/sdk-dapp-core-ui": "0.0.0-alpha.0"
},
"resolutions": {
"string-width": "4.1.0"
},
"devDependencies": {
"@multiversx/sdk-core": ">= 13.0.0",
"@multiversx/sdk-dapp-utils": ">= 0.1.0",
"@multiversx/sdk-web-wallet-cross-window-provider": ">= 1.0.0",
"@eslint/js": "9.15.0",
"@swc/core": "^1.4.17",
"@swc/jest": "^0.2.36",
"@types/jest": "29.5.13",
"@types/lodash": "4.17.4",
"@types/node": "20.12.8",
"@typescript-eslint/eslint-plugin": "7.8.0",
"@typescript-eslint/parser": "7.8.0",
"@typescript-eslint/eslint-plugin": "8.15.0",
"@typescript-eslint/parser": "8.15.0",
"axios": ">=1.6.5",
"axios-mock-adapter": "^1.22.0",
"axios-mock-adapter": "1.22.0",
"bignumber.js": "9.x",
"esbuild": "^0.21.1",
"esbuild": "0.21.1",
"esbuild-node-externals": "1.14.0",
"eslint": "9.1.1",
"eslint": "9.15.0",
"eslint-config-prettier": "9.1.0",
"eslint-config-standard": "17.1.0",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-plugin-import": "2.29.1",
"eslint-import-resolver-typescript": "3.6.3",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-jest": "28.9.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-promise": "6.1.1",
"glob": "^10.3.14",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-promise": "7.1.0",
"glob": "10.3.14",
"immer": "^10.1.1",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"msw": "1.3.1",
"node-stdlib-browser": "1.2.0",
"prettier": "3.2.5",
"protobufjs": "^7.3.0",
"react": "^18.3.1",
"rimraf": "^5.0.6",
"ts-jest": "29.1.2",
"tsc-alias": "^1.8.9",
"typescript": "^5.4.5"
"typescript": "5.4.5",
"typescript-eslint": "8.15.0"
}
}
2 changes: 0 additions & 2 deletions src/__mocks__/utils/mockWindowHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ export const mockWindowHistory = () => {

const history = window.history;

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete window.history;

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
window.history = Object.defineProperties(
{},
Expand Down
2 changes: 0 additions & 2 deletions src/__mocks__/utils/mockWindowLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ export const mockWindowLocation = () => {

const location = window.location;

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete window.location;

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
window.location = Object.defineProperties(
{},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { ACCOUNTS_ENDPOINT } from 'apiCalls/endpoints';
import { axiosInstance } from 'apiCalls/utils/axiosInstance';
import { getCleanApiAddress } from 'apiCalls/utils/getCleanApiAddress';
import { TIMEOUT } from 'constants/network.constants';
import { AccountType } from 'types/account.types';

export const accountFetcher = (address: string | null) => {
const apiAddress = getCleanApiAddress();
const url = `${apiAddress}/${ACCOUNTS_ENDPOINT}/${address}?withGuardianInfo=true`;
// we need to get it with an axios instance because of cross-window user interaction issues
return axiosInstance.get(url, {
baseURL: apiAddress
baseURL: apiAddress,
timeout: TIMEOUT
});
};

Expand All @@ -20,7 +22,7 @@ export const getAccountFromApi = async (address?: string) => {
try {
const { data } = await accountFetcher(address);
return data as AccountType;
} catch (err) {
} catch (_err) {
console.error('error fetching configuration for ', address);
}

Expand Down
18 changes: 18 additions & 0 deletions src/apiCalls/account/getScamAddressData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import axios from 'axios';
import { getCleanApiAddress } from 'apiCalls/utils';
import { TIMEOUT } from 'constants/index';
import { ScamInfoType } from 'types/account.types';
import { ACCOUNTS_ENDPOINT } from '../endpoints';

export async function getScamAddressData(addressToVerify: string) {
const apiAddress = getCleanApiAddress();

const { data } = await axios.get<{
scamInfo?: ScamInfoType;
code?: string;
}>(`${apiAddress}/${ACCOUNTS_ENDPOINT}/${addressToVerify}`, {
timeout: TIMEOUT
});

return data;
}
File renamed without changes.
2 changes: 1 addition & 1 deletion src/apiCalls/configuration/getNetworkConfigFromApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function getNetworkConfigFromApi() {
if (data != null) {
return data?.data?.config;
}
} catch (err) {
} catch (_err) {
console.error('error fetching configuration for ', configUrl);
}
return null;
Expand Down
Loading
Loading