From f45c284fb4cc7943222fff7e6c0791960cc683a4 Mon Sep 17 00:00:00 2001 From: Jan Marcano Date: Thu, 14 Oct 2021 12:51:08 -0300 Subject: [PATCH 1/3] Bump sdk to v1.12.0 --- packages/extension/package.json | 2 +- packages/test-project/package.json | 2 +- packages/ui/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/extension/package.json b/packages/extension/package.json index 75e93185..7e535e2b 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -20,7 +20,7 @@ "webpack-cli": "^3.3.11" }, "dependencies": { - "algosdk": "1.11.1" + "algosdk": "1.12.0" }, "scripts": { "build": "npm run clean && npm run bundle && npm run copy", diff --git a/packages/test-project/package.json b/packages/test-project/package.json index d74c1b59..dc9aa723 100644 --- a/packages/test-project/package.json +++ b/packages/test-project/package.json @@ -5,7 +5,7 @@ "license": "MIT", "description": "Repository for tests", "devDependencies": { - "algosdk": "1.11.1", + "algosdk": "1.12.0", "jest": "27.0.0", "jest-runner-groups": "^2.0.1", "puppeteer": "^5.5.0", diff --git a/packages/ui/package.json b/packages/ui/package.json index f08cef60..00fdbfbd 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -16,7 +16,7 @@ "@fortawesome/fontawesome-free": "^5.15.0", "@ledgerhq/hw-app-algorand": "^5.51.1", "@ledgerhq/hw-transport-webhid": "^5.46.0", - "algosdk": "1.11.1", + "algosdk": "1.12.0", "history": "^5.0.0", "htm": "^3.0.4", "mobx": "^5.15.6", From 2e16fb42d19fea3ecc1473e66cc22f6dc4619784 Mon Sep 17 00:00:00 2001 From: Jan Marcano Date: Fri, 15 Oct 2021 12:24:27 -0300 Subject: [PATCH 2/3] Update to latest Webpack & Typescript versions --- packages/common/package.json | 4 +- packages/crypto/package.json | 8 +- packages/dapp/package.json | 8 +- packages/extension/package.json | 11 +-- packages/extension/webpack.config.js | 83 +++++++++++-------- packages/storage/package.json | 9 +- packages/test-project/tests/common/tests.js | 19 +++-- .../tests/ui-networks-e2e.test.js | 16 ++-- packages/ui/package.json | 25 +++--- packages/ui/webpack.config.js | 8 ++ 10 files changed, 107 insertions(+), 84 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index 63b6cf4e..04ef8232 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -10,8 +10,8 @@ "jest": "27.0.0", "jest-webextension-mock": "^3.6.1", "ts-jest": "^27.0.0", - "ts-loader": "^8.0.3", - "typescript": "^3.7.5" + "ts-loader": "^9.2.6", + "typescript": "^4.4.4" }, "scripts": { "build": "npm run clean && tsc", diff --git a/packages/crypto/package.json b/packages/crypto/package.json index b2719f06..aaf2c92d 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -12,10 +12,10 @@ "@types/jest": "^27.0.0", "jest": "27.0.0", "ts-jest": "^27.0.0", - "ts-loader": "^7.0.5", - "typescript": "^3.9.7", - "webpack": "^4.44.1", - "webpack-cli": "^3.3.11" + "ts-loader": "^9.2.6", + "typescript": "^4.4.4", + "webpack": "^5.58.2", + "webpack-cli": "^4.9.0" }, "scripts": { "build": "npm run clean && webpack", diff --git a/packages/dapp/package.json b/packages/dapp/package.json index d9e33357..a2af9f83 100644 --- a/packages/dapp/package.json +++ b/packages/dapp/package.json @@ -14,9 +14,9 @@ "@types/jest": "^27.0.0", "jest": "27.0.0", "ts-jest": "^27.0.0", - "ts-loader": "^7.0.5", - "typescript": "^3.9.7", - "webpack": "^4.44.1", - "webpack-cli": "^3.3.11" + "ts-loader": "^9.2.6", + "typescript": "^4.4.4", + "webpack": "^5.58.2", + "webpack-cli": "^4.9.0" } } diff --git a/packages/extension/package.json b/packages/extension/package.json index 7e535e2b..eae1a0a9 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -14,13 +14,14 @@ "jest": "27.0.0", "jest-webextension-mock": "^3.6.1", "ts-jest": "^27.0.0", - "ts-loader": "^7.0.5", - "typescript": "^4.3.2", - "webpack": "^4.44.1", - "webpack-cli": "^3.3.11" + "ts-loader": "^9.2.6", + "typescript": "^4.4.4", + "webpack": "^5.58.2", + "webpack-cli": "^4.9.0" }, "dependencies": { - "algosdk": "1.12.0" + "algosdk": "1.12.0", + "buffer": "^6.0.3" }, "scripts": { "build": "npm run clean && npm run bundle && npm run copy", diff --git a/packages/extension/webpack.config.js b/packages/extension/webpack.config.js index cd47d719..658ea79c 100644 --- a/packages/extension/webpack.config.js +++ b/packages/extension/webpack.config.js @@ -1,45 +1,56 @@ var path = require('path'); +const webpack = require('webpack'); function srcPath(subdir) { - return path.join(__dirname, "./", subdir); + return path.join(__dirname, './', subdir); } module.exports = { - // Change to your "entry-point". - mode: 'production', - optimization: { - // We no not want to minimize our code. - minimize: false - }, - entry: { - background: './src/background/index.ts', - content: './src/content/content.ts' + // Change to your "entry-point". + mode: 'production', + optimization: { + // We no not want to minimize our code. + minimize: false, + }, + entry: { + background: './src/background/index.ts', + content: './src/content/content.ts', + }, + output: { + path: path.resolve(__dirname, 'dist'), + filename: '[name].js', + }, + plugins: [ + // Generate a base html file and injects all generated css and js files + new webpack.ProvidePlugin({ + Buffer: ['buffer', 'Buffer'], + }), + ], + resolve: { + alias: { + '@algosigner/common': srcPath('../common/src'), + '@algosigner/crypto': srcPath('../crypto'), + '@algosigner/storage': srcPath('../storage'), + '@algosigner/ui': srcPath('../ui'), }, - output: { - path: path.resolve(__dirname, 'dist'), - filename: '[name].js', + extensions: ['.ts', '.tsx', '.js', '.json'], + fallback: { + buffer: require.resolve('buffer'), + crypto: false, }, - resolve: { - alias: { - '@algosigner/common': srcPath('../common/src'), - '@algosigner/crypto': srcPath('../crypto'), - '@algosigner/storage': srcPath('../storage'), - '@algosigner/ui': srcPath('../ui') - }, - extensions: ['.ts', '.tsx', '.js', '.json'] - }, - module: { - rules: [ - { - test: /\.(ts|js)x?$/, - exclude: /node_modules/, - use: [ - { - loader: "ts-loader", - options: {} - } - ] - } - ] - } + }, + module: { + rules: [ + { + test: /\.(ts|js)x?$/, + exclude: /node_modules/, + use: [ + { + loader: 'ts-loader', + options: {}, + }, + ], + }, + ], + }, }; diff --git a/packages/storage/package.json b/packages/storage/package.json index 0e11ab76..f4fd20a7 100644 --- a/packages/storage/package.json +++ b/packages/storage/package.json @@ -6,12 +6,11 @@ "license": "MIT", "description": "Storage wrapper for saving and retrieving extention information in Algosigner.", "devDependencies": { - "ts-loader": "^7.0.5", - "typescript": "^3.9.7", - "webpack": "^4.44.1", - "webpack-cli": "^3.3.11" + "ts-loader": "^9.2.6", + "typescript": "^4.4.4", + "webpack": "^5.58.2", + "webpack-cli": "^4.9.0" }, - "dependencies": {}, "scripts": { "build": "npm run clean && webpack", "clean": "rm -rf ./dist/" diff --git a/packages/test-project/tests/common/tests.js b/packages/test-project/tests/common/tests.js index 3473afa1..c987b72c 100644 --- a/packages/test-project/tests/common/tests.js +++ b/packages/test-project/tests/common/tests.js @@ -2,7 +2,7 @@ const { wallet, extension } = require('./constants'); const { openAccountDetails, goBack, closeModal, inputPassword, getPopup } = require('./helpers'); // Common Tests -async function WelcomePage() { +function WelcomePage() { test('Welcome Page Title', async () => { await expect(extensionPage.title()).resolves.toMatch(extension.name); }); @@ -17,7 +17,7 @@ async function WelcomePage() { }); } -async function SetPassword() { +function SetPassword() { test('Set new Wallet Password', async () => { await extensionPage.type('#setPassword', wallet.password); await extensionPage.type('#confirmPassword', wallet.password); @@ -25,7 +25,7 @@ async function SetPassword() { }); } -async function SelectTestNetLedger() { +function SelectTestNetLedger() { test('Switch Ledger', async () => { await extensionPage.waitForSelector('#selectLedger'); await extensionPage.click('#selectLedger'); @@ -34,13 +34,13 @@ async function SelectTestNetLedger() { }); } -async function CreateWallet() { +function CreateWallet() { WelcomePage(); SetPassword(); SelectTestNetLedger(); } -async function ImportAccount(account) { +function ImportAccount(account) { test(`Import Account ${account.name}`, async () => { await extensionPage.waitForSelector('#addAccount'); await extensionPage.click('#addAccount'); @@ -51,12 +51,13 @@ async function ImportAccount(account) { await extensionPage.type('#enterMnemonic', account.mnemonic); await extensionPage.click('#nextStep'); await inputPassword(); + await extensionPage.waitForTimeout(2000); }); - await VerifyAccount(account); + VerifyAccount(account); } -async function VerifyAccount(account) { +function VerifyAccount(account) { test(`Verify Account Info (${account.name})`, async () => { await openAccountDetails(account); await expect(extensionPage.$eval('#accountAddress', (e) => e.innerText)).resolves.toBe( @@ -67,7 +68,7 @@ async function VerifyAccount(account) { }); } -async function DeleteAccount(account) { +function DeleteAccount(account) { test(`Delete Account (${account.name})`, async () => { await openAccountDetails(account); await extensionPage.click('#deleteAccount'); @@ -84,7 +85,7 @@ async function DeleteAccount(account) { } // Dapp Tests -async function ConnectAlgoSigner() { +function ConnectAlgoSigner() { test('Expose Authorize Functions', async () => { async function authorizeDapp() { const popup = await getPopup(); diff --git a/packages/test-project/tests/ui-networks-e2e.test.js b/packages/test-project/tests/ui-networks-e2e.test.js index 0a1ca11a..e584c4bb 100644 --- a/packages/test-project/tests/ui-networks-e2e.test.js +++ b/packages/test-project/tests/ui-networks-e2e.test.js @@ -9,13 +9,13 @@ const { openExtension, inputPassword } = require('./common/helpers'); const { CreateWallet, ImportAccount } = require('./common/tests'); const openNetworkMenu = async () => { - await extensionPage.waitForTimeout(500); + await extensionPage.waitForTimeout(1000); await extensionPage.waitForSelector('#options-menu'); await extensionPage.click('#options-menu'); await extensionPage.waitForSelector('#showNetworkConfiguration'); await extensionPage.click('#showNetworkConfiguration'); - await extensionPage.waitForTimeout(500); -} + await extensionPage.waitForTimeout(1000); +}; jest.setTimeout(20000); @@ -37,7 +37,7 @@ describe('Create and Test Custom Networks', () => { }; const e2eNetSelector = `button#select${NetworkConfig.name}`; - const otherNet = 'OtherNet' + const otherNet = 'OtherNet'; const otherNetSelector = `button#select${otherNet}`; test('Add Custom TestNet and test it', async () => { @@ -63,6 +63,7 @@ describe('Create and Test Custom Networks', () => { // Fill correct network config await extensionPage.evaluate(() => (document.getElementById('networkAlgodUrl').value = '')); + await extensionPage.waitForTimeout(1000); await extensionPage.type('#networkAlgodUrl', NetworkConfig.algod); // Test connection succesful @@ -71,7 +72,7 @@ describe('Create and Test Custom Networks', () => { await expect(extensionPage.select('#networkError')).rejects.toThrow(); // // Save Network - await extensionPage.waitForTimeout(2000); + await extensionPage.waitForTimeout(1000); await extensionPage.click('#saveNetwork:not(disabled)'); }); @@ -79,9 +80,10 @@ describe('Create and Test Custom Networks', () => { test('Test Modifying Network', async () => { await openNetworkMenu(); - + // Change Network name - await extensionPage.click(`button#select${NetworkConfig.name}`); + await extensionPage.waitForSelector(e2eNetSelector); + await extensionPage.click(e2eNetSelector); await extensionPage.waitForSelector('#networkName'); await extensionPage.evaluate(() => (document.getElementById('networkName').value = '')); await extensionPage.type('#networkName', otherNet); diff --git a/packages/ui/package.json b/packages/ui/package.json index 00fdbfbd..3bde410d 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -17,6 +17,7 @@ "@ledgerhq/hw-app-algorand": "^5.51.1", "@ledgerhq/hw-transport-webhid": "^5.46.0", "algosdk": "1.12.0", + "buffer": "^6.0.3", "history": "^5.0.0", "htm": "^3.0.4", "mobx": "^5.15.6", @@ -30,24 +31,24 @@ "@creativebulma/bulma-tooltip": "^1.2.0", "@types/chrome": "0.0.116", "@types/jest": "^27.0.0", - "bulma": "^0.9.0", - "css-loader": "^3.6.0", + "bulma": "^0.9.3", + "css-loader": "^6.4.0", "enzyme": "^3.11.0", "enzyme-adapter-preact-pure": "^2.2.3", "enzyme-to-json": "^3.6.1", - "file-loader": "^6.1.0", - "html-webpack-plugin": "^4.4.1", + "file-loader": "^6.2.0", + "html-webpack-plugin": "^5.3.2", "identity-obj-proxy": "^3.0.0", "jest": "27.0.0", "jest-webextension-mock": "^3.6.1", - "mini-css-extract-plugin": "^1.6.0", - "sass": "^1.26.10", - "sass-loader": "^8.0.2", + "mini-css-extract-plugin": "^2.4.2", + "sass": "^1.43.2", + "sass-loader": "^12.2.0", "ts-jest": "^27.0.0", - "ts-loader": "^7.0.1", - "typescript": "^4.3.2", - "webpack": "^4.44.1", - "webpack-cli": "^3.3.11", - "webpack-dev-server": "^3.11.2" + "ts-loader": "^9.2.6", + "typescript": "^4.4.4", + "webpack": "^5.58.2", + "webpack-cli": "^4.9.0", + "webpack-dev-server": "^4.3.1" } } diff --git a/packages/ui/webpack.config.js b/packages/ui/webpack.config.js index cfb44dbc..3788b1f2 100644 --- a/packages/ui/webpack.config.js +++ b/packages/ui/webpack.config.js @@ -1,6 +1,7 @@ const path = require('path'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); +const webpack = require('webpack'); // function srcPath(subdir) { // return path.join(__dirname, './', subdir); @@ -56,6 +57,9 @@ module.exports = { new MiniCssExtractPlugin({ filename: 'styles.css', }), + new webpack.ProvidePlugin({ + Buffer: ['buffer', 'Buffer'], + }), ], resolve: { extensions: ['.tsx', '.ts', '.js'], @@ -67,6 +71,10 @@ module.exports = { 'stream': require.resolve('readable-stream'), }, modules: [path.resolve('./src'), path.resolve('./node_modules')], + fallback: { + buffer: require.resolve('buffer'), + crypto: false, + }, }, devServer: { contentBase: './dist', From d78348706d5b38cc94a625aa6a3ec847ac90197f Mon Sep 17 00:00:00 2001 From: Jan Marcano Date: Fri, 15 Oct 2021 14:52:16 -0300 Subject: [PATCH 3/3] Patch 1.6.7 --- README.md | 4 ++++ package.json | 2 +- packages/common/package.json | 2 +- packages/crypto/package.json | 2 +- packages/dapp/package.json | 2 +- packages/extension/manifest.json | 2 +- packages/extension/package.json | 2 +- packages/storage/package.json | 2 +- packages/test-project/package.json | 2 +- packages/ui/package.json | 2 +- 10 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 119b7f97..5a2fb6a9 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,10 @@ Added ability to use a Ledger device to add public addresses into AlgoSigner and - Fix for rare infinite loop locking extension sign page - Fix for display of estimated fee for Ledger device sign +### 1.6.7 Patch +- Update to SDK v1.12.0 +- Update to Webpack 5 + ## New Users - Watch [Getting Started with AlgoSigner](https://youtu.be/tG-xzG8r770) diff --git a/package.json b/package.json index 36270e4c..d3d39f0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "algosigner", - "version": "1.6.6", + "version": "1.6.7", "author": "https://developer.purestake.io", "description": "Sign Algorand transactions in your browser with PureStake.", "repository": "https://github.com/PureStake/algosigner", diff --git a/packages/common/package.json b/packages/common/package.json index 04ef8232..45c98c40 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@algosigner/common", - "version": "1.6.6", + "version": "1.6.7", "author": "https://developer.purestake.io", "description": "Common library functions for AlgoSigner.", "repository": "https://github.com/PureStake/algosigner", diff --git a/packages/crypto/package.json b/packages/crypto/package.json index aaf2c92d..670022fa 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -1,6 +1,6 @@ { "name": "algosigner-crypto", - "version": "1.6.6", + "version": "1.6.7", "author": "https://developer.purestake.io", "description": "Cryptographic wrapper for saving and retrieving extention information in Algosigner.", "repository": { diff --git a/packages/dapp/package.json b/packages/dapp/package.json index a2af9f83..a6b5cf69 100644 --- a/packages/dapp/package.json +++ b/packages/dapp/package.json @@ -1,6 +1,6 @@ { "name": "@algosigner/dapp", - "version": "1.6.6", + "version": "1.6.7", "author": "https://developer.purestake.io", "repository": "https://github.com/PureStake/algosigner", "license": "MIT", diff --git a/packages/extension/manifest.json b/packages/extension/manifest.json index eab5d482..e16a29d5 100644 --- a/packages/extension/manifest.json +++ b/packages/extension/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "AlgoSigner", "author": "https://developer.purestake.io", - "version": "1.6.6", + "version": "1.6.7", "description": "Algorand Wallet Extension | Send & Receive ALGOs | Sign dApp Transactions", "icons": { "48": "icon.png" diff --git a/packages/extension/package.json b/packages/extension/package.json index eae1a0a9..268c0009 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -1,6 +1,6 @@ { "name": "algosigner-extension", - "version": "1.6.6", + "version": "1.6.7", "author": "https://developer.purestake.io", "repository": "https://github.com/PureStake/algosigner", "license": "MIT", diff --git a/packages/storage/package.json b/packages/storage/package.json index f4fd20a7..2ca4ca67 100644 --- a/packages/storage/package.json +++ b/packages/storage/package.json @@ -1,6 +1,6 @@ { "name": "algosigner-storage", - "version": "1.6.6", + "version": "1.6.7", "author": "https://developer.purestake.io", "repository": "https://github.com/PureStake/algosigner", "license": "MIT", diff --git a/packages/test-project/package.json b/packages/test-project/package.json index dc9aa723..8b7fce81 100644 --- a/packages/test-project/package.json +++ b/packages/test-project/package.json @@ -1,6 +1,6 @@ { "name": "algorand-test-project", - "version": "1.6.6", + "version": "1.6.7", "repository": "https://github.com/PureStake/algosigner", "license": "MIT", "description": "Repository for tests", diff --git a/packages/ui/package.json b/packages/ui/package.json index 3bde410d..2b96aaff 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "algosigner-ui", - "version": "1.6.6", + "version": "1.6.7", "author": "https://developer.purestake.io", "repository": "https://github.com/PureStake/algosigner", "license": "MIT",