From 04936df192dc224a81859c58e436b93b1e3124e3 Mon Sep 17 00:00:00 2001 From: Vladan Date: Mon, 11 Sep 2023 11:53:21 +0200 Subject: [PATCH 1/5] feat: new gas estimation --- .../MetamaskCreateAccount.tsx | 10 +--------- src/utils/ens.ts | 19 ++----------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/src/components/Dialogs/MetamaskMigrationDialog/MetamaskCreateAccount.tsx b/src/components/Dialogs/MetamaskMigrationDialog/MetamaskCreateAccount.tsx index 665bf1d7..3a1d12e0 100644 --- a/src/components/Dialogs/MetamaskMigrationDialog/MetamaskCreateAccount.tsx +++ b/src/components/Dialogs/MetamaskMigrationDialog/MetamaskCreateAccount.tsx @@ -130,15 +130,7 @@ export default function MetamaskCreateAccount({ }; const getFeePrice = async () => { - const { address } = fdpClientRef.current.account.wallet; - const { publicKey } = fdpClientRef.current.account; - - const price = await estimateRegistrationPrice( - username, - address, - publicKey, - network - ); + const price = await estimateRegistrationPrice(network); setMinBalance(price); }; diff --git a/src/utils/ens.ts b/src/utils/ens.ts index ff944c68..c54aa1d1 100644 --- a/src/utils/ens.ts +++ b/src/utils/ens.ts @@ -5,26 +5,11 @@ import { BigNumber, providers } from 'ethers'; const FDS_DOMAIN = 'fds'; export async function estimateRegistrationPrice( - username: string, - address: string, - publicKey: string, network: Network ): Promise { const provider = new providers.JsonRpcProvider(network.config.rpcUrl); - const ens = new ENS( - // A workaround for gas estimation on sepolia - network.id === Environments.SEPOLIA - ? { ...network.config, rpcUrl: 'http://rpc.sepolia.org' } - : network.config, - provider, - FDS_DOMAIN - ); - const [gasAmount, gasPrice] = await Promise.all([ - ens.registerUsernameEstimateGas(username, address, publicKey), - provider.getFeeData(), - ]); - - return gasPrice.maxFeePerGas.mul(gasAmount); + const ens = new ENS(network.config, provider, FDS_DOMAIN); + return ens.registerUsernameApproximatePrice(); } export function getAccountBalance( From 024b93ce9ac87bfbe3f0e15432901e2341441a6a Mon Sep 17 00:00:00 2001 From: Vladan Date: Thu, 14 Sep 2023 14:35:53 +0200 Subject: [PATCH 2/5] chore: new fdp-storage --- package-lock.json | 60 +++++++++++++++++++++++++++++++++++------------ package.json | 2 +- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 699ae0c4..cff177b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@emotion/react": "^11.4.1", "@emotion/styled": "^11.3.0", "@fairdatasociety/blossom": "^0.5.0", - "@fairdatasociety/fdp-storage": "^0.11.0", + "@fairdatasociety/fdp-storage": "^0.12.0", "@headlessui/react": "^1.7.14", "@metamask/sdk": "^0.5.6", "@types/react-blockies": "^1.4.1", @@ -3055,21 +3055,37 @@ "@fairdatasociety/fdp-storage": "^0.11.0" } }, + "node_modules/@fairdatasociety/blossom/node_modules/@fairdatasociety/fdp-storage": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-storage/-/fdp-storage-0.11.0.tgz", + "integrity": "sha512-Na56ZOmb2cBpm1Z4RaIn0ASJXlLrN/FBg3IfI9ExPDBVxd1jdeMg7P4YY2pQkHRp3fKOtHK/bB4v0nB+tHZIKQ==", + "dependencies": { + "@ethersphere/bee-js": "^6.2.0", + "@fairdatasociety/fdp-contracts-js": "^3.7.1", + "crypto-js": "^4.1.1", + "ethers": "^5.5.2", + "js-sha3": "^0.8.0" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=8.0.0" + } + }, "node_modules/@fairdatasociety/fdp-contracts-js": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-contracts-js/-/fdp-contracts-js-3.7.1.tgz", - "integrity": "sha512-G1TMIAJPIsfxEvubZh2qiiQb4XJx07jdmwUIvBNR2+PCdN2KnCNYQo1b4xkSFxk8BzY7hnXtricmIlNUmv3N0w==", + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-contracts-js/-/fdp-contracts-js-3.8.0.tgz", + "integrity": "sha512-Lfr/kxCBZ4IYWwAkeRa2fSi9suYd5DxTG5xunfuwMm32FeB99fL7tI19sb5tjPyRj6bphJPaRWmFCdPJ+yfZsg==", "peerDependencies": { "ethers": ">=5.6.4" } }, "node_modules/@fairdatasociety/fdp-storage": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-storage/-/fdp-storage-0.11.0.tgz", - "integrity": "sha512-Na56ZOmb2cBpm1Z4RaIn0ASJXlLrN/FBg3IfI9ExPDBVxd1jdeMg7P4YY2pQkHRp3fKOtHK/bB4v0nB+tHZIKQ==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-storage/-/fdp-storage-0.12.0.tgz", + "integrity": "sha512-MFFEjTUedvUAUvz+a1pp6/vtq8/3igy173dCx8BM2Bh7YLs+KK5ytbxgBokUDldZM9vxiEHD4Miwi5bq60gN5w==", "dependencies": { "@ethersphere/bee-js": "^6.2.0", - "@fairdatasociety/fdp-contracts-js": "^3.7.1", + "@fairdatasociety/fdp-contracts-js": "^3.8.0", "crypto-js": "^4.1.1", "ethers": "^5.5.2", "js-sha3": "^0.8.0" @@ -24969,21 +24985,35 @@ "integrity": "sha512-IoKkn2GEuD95yJ763AWuUA153oZEjKH5DOJgGTf48QFkiyuLlLc1OCGveh9tj5fE0LavK0M78x4ZqMKVlmT8BQ==", "requires": { "@fairdatasociety/fdp-storage": "^0.11.0" + }, + "dependencies": { + "@fairdatasociety/fdp-storage": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-storage/-/fdp-storage-0.11.0.tgz", + "integrity": "sha512-Na56ZOmb2cBpm1Z4RaIn0ASJXlLrN/FBg3IfI9ExPDBVxd1jdeMg7P4YY2pQkHRp3fKOtHK/bB4v0nB+tHZIKQ==", + "requires": { + "@ethersphere/bee-js": "^6.2.0", + "@fairdatasociety/fdp-contracts-js": "^3.7.1", + "crypto-js": "^4.1.1", + "ethers": "^5.5.2", + "js-sha3": "^0.8.0" + } + } } }, "@fairdatasociety/fdp-contracts-js": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-contracts-js/-/fdp-contracts-js-3.7.1.tgz", - "integrity": "sha512-G1TMIAJPIsfxEvubZh2qiiQb4XJx07jdmwUIvBNR2+PCdN2KnCNYQo1b4xkSFxk8BzY7hnXtricmIlNUmv3N0w==", + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-contracts-js/-/fdp-contracts-js-3.8.0.tgz", + "integrity": "sha512-Lfr/kxCBZ4IYWwAkeRa2fSi9suYd5DxTG5xunfuwMm32FeB99fL7tI19sb5tjPyRj6bphJPaRWmFCdPJ+yfZsg==", "requires": {} }, "@fairdatasociety/fdp-storage": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-storage/-/fdp-storage-0.11.0.tgz", - "integrity": "sha512-Na56ZOmb2cBpm1Z4RaIn0ASJXlLrN/FBg3IfI9ExPDBVxd1jdeMg7P4YY2pQkHRp3fKOtHK/bB4v0nB+tHZIKQ==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-storage/-/fdp-storage-0.12.0.tgz", + "integrity": "sha512-MFFEjTUedvUAUvz+a1pp6/vtq8/3igy173dCx8BM2Bh7YLs+KK5ytbxgBokUDldZM9vxiEHD4Miwi5bq60gN5w==", "requires": { "@ethersphere/bee-js": "^6.2.0", - "@fairdatasociety/fdp-contracts-js": "^3.7.1", + "@fairdatasociety/fdp-contracts-js": "^3.8.0", "crypto-js": "^4.1.1", "ethers": "^5.5.2", "js-sha3": "^0.8.0" diff --git a/package.json b/package.json index d3c19caa..4e5a09e6 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@emotion/react": "^11.4.1", "@emotion/styled": "^11.3.0", "@fairdatasociety/blossom": "^0.5.0", - "@fairdatasociety/fdp-storage": "^0.11.0", + "@fairdatasociety/fdp-storage": "^0.12.0", "@headlessui/react": "^1.7.14", "@metamask/sdk": "^0.5.6", "@types/react-blockies": "^1.4.1", From 4dcec8cf99af4121e53ed392bc401258dc6d0a27 Mon Sep 17 00:00:00 2001 From: Vladan Date: Thu, 14 Sep 2023 14:36:14 +0200 Subject: [PATCH 3/5] fix: metamask dialog layout --- .../Dialogs/MetamaskMigrationDialog/MetamaskCreateAccount.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Dialogs/MetamaskMigrationDialog/MetamaskCreateAccount.tsx b/src/components/Dialogs/MetamaskMigrationDialog/MetamaskCreateAccount.tsx index 3a1d12e0..646a5f8c 100644 --- a/src/components/Dialogs/MetamaskMigrationDialog/MetamaskCreateAccount.tsx +++ b/src/components/Dialogs/MetamaskMigrationDialog/MetamaskCreateAccount.tsx @@ -182,7 +182,7 @@ export default function MetamaskCreateAccount({ <>
{intl.get('YOUR_ACCOUNT_IS')}
- + {address} From 170c29831b9814ca4c12c4215170035d71c3fe75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladan=20Tomi=C4=87?= Date: Tue, 19 Sep 2023 12:37:47 +0200 Subject: [PATCH 4/5] fix: change login label (#509) --- src/components/Forms/LoginForm/LoginForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Forms/LoginForm/LoginForm.tsx b/src/components/Forms/LoginForm/LoginForm.tsx index f681740c..532514e2 100644 --- a/src/components/Forms/LoginForm/LoginForm.tsx +++ b/src/components/Forms/LoginForm/LoginForm.tsx @@ -155,7 +155,7 @@ const LoginForm: FC = () => { disabled={!isValid} type="submit" variant="secondary" - label={intl.get('CONTINUE')} + label={intl.get('LOGIN')} />
From 3941bcd8a81569dca8f1bad47fc4ee6bd0a8500e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladan=20Tomi=C4=87?= Date: Wed, 20 Sep 2023 11:09:28 +0200 Subject: [PATCH 5/5] feat: import button removed --- .../AuthenticationNavbar.tsx | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/components/NavigationBars/AuthenticationNavbar/AuthenticationNavbar.tsx b/src/components/NavigationBars/AuthenticationNavbar/AuthenticationNavbar.tsx index 4672192b..ed42efa6 100644 --- a/src/components/NavigationBars/AuthenticationNavbar/AuthenticationNavbar.tsx +++ b/src/components/NavigationBars/AuthenticationNavbar/AuthenticationNavbar.tsx @@ -20,24 +20,6 @@ const AuthenticationNavbar: FC = () => {