Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Merge pull request #448 from PureStake/master
Browse files Browse the repository at this point in the history
Patch 1.9.5
  • Loading branch information
PureBrent authored Sep 8, 2022
2 parents 90529a6 + eb0a11b commit 8869b6d
Show file tree
Hide file tree
Showing 35 changed files with 433 additions and 163 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Developers working with dApps may also install directly from the release package

An interactive transition guide is available [here](https://purestake.github.io/algosigner-dapp-example/v1v2TransitionGuide.html).

## 1.9.4 Release
## 1.9.5 Release

### Main updates
This update adds supports for easier transfers with the new autocomplete feature. Start typing an account, contact name or name service alias on the destination field when sending Algos or ASAs and you'll be able to select the desired address from a dropdown. This also marks the end of the support of the older signing methods that were previously available.
Expand All @@ -23,6 +23,7 @@ This update adds supports for easier transfers with the new autocomplete feature
- Accounts and Contact names
- External name services (NFDomains and Algorand Namespace Service)
- `AlgoSigner.sign()` and `AlgoSigner.signMultisig()` have been deprecated
- New Account creation now occurs in the browser, improving ease of use when saving the mnemonic

### Other updates
- Improved Account Importing and Cache Clearing
Expand Down
4 changes: 3 additions & 1 deletion docs/connection-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ If you're having issues accessing a dApp using AlgoSigner, you can try the follo

## Connection Troubleshooting

Find and press any disconnect button present on the dApp.
Find and press any 'Disconnect' button present on the dApp.

<img src="./connection_images/disconnect.png" width="300" />
<br />
<img src="./connection_images/disconnect2.png" width="300" />
<br />

Open the config menu and log out of AlgoSigner.

Expand Down
Binary file added docs/connection_images/disconnect2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "algosigner",
"version": "1.9.4",
"version": "1.9.5",
"author": "https://developer.purestake.io",
"description": "Sign Algorand transactions in your browser with PureStake.",
"repository": "https://github.com/PureStake/algosigner",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@algosigner/common",
"version": "1.9.4",
"version": "1.9.5",
"author": "https://developer.purestake.io",
"description": "Common library functions for AlgoSigner.",
"repository": "https://github.com/PureStake/algosigner",
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "algosigner-crypto",
"version": "1.9.4",
"version": "1.9.5",
"author": "https://developer.purestake.io",
"description": "Cryptographic wrapper for saving and retrieving extention information in AlgoSigner.",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/dapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@algosigner/dapp",
"version": "1.9.4",
"version": "1.9.5",
"author": "https://developer.purestake.io",
"repository": "https://github.com/PureStake/algosigner",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "AlgoSigner",
"author": "https://developer.purestake.io",
"version": "1.9.4",
"version": "1.9.5",
"description": "Algorand Wallet Extension | Send & Receive ALGOs | Sign dApp Transactions",
"icons": {
"48": "icon.png"
Expand Down
2 changes: 1 addition & 1 deletion packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "algosigner-extension",
"version": "1.9.4",
"version": "1.9.5",
"author": "https://developer.purestake.io",
"repository": "https://github.com/PureStake/algosigner",
"license": "MIT",
Expand Down
8 changes: 4 additions & 4 deletions packages/extension/src/background/messaging/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ export class Task {
let code = 4300;

validationErrors.forEach((error, index) => {
data = data + `Validation failed for transaction ${index} due to: ${error.message}.`;
data = data + `Validation failed for transaction ${index} due to: ${error.message}. `;
code = error.code && error.code < code ? error.code : code;
});
throw RequestError.SigningError(code, data);
throw RequestError.SigningError(code, data.trim());
} else if (
transactionWraps.some(
(tx) =>
Expand Down Expand Up @@ -1027,13 +1027,13 @@ export class Task {
let data = '';
if (transactionObjs.length > 1) {
signErrors.forEach((error, index) => {
data += `On transaction ${index}, the error was: ${error}.`;
data += `On transaction ${index}, the error was: ${error}. `;
});
} else {
data += signErrors[0];
}
if (!singleGroup) {
data = `On group ${currentGroup}: [${data}].`;
data = `On group ${currentGroup}: [${data.trim()}]. `;
}
message.error = RequestError.SigningError(4000, data);
logging.log(data);
Expand Down
2 changes: 1 addition & 1 deletion packages/storage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "algosigner-storage",
"version": "1.9.4",
"version": "1.9.5",
"author": "https://developer.purestake.io",
"repository": "https://github.com/PureStake/algosigner",
"license": "MIT",
Expand Down
5 changes: 3 additions & 2 deletions packages/test-project/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "algorand-test-project",
"version": "1.9.4",
"version": "1.9.5",
"repository": "https://github.com/PureStake/algosigner",
"license": "MIT",
"description": "Repository for tests",
Expand All @@ -21,7 +21,8 @@
"dapp": "jest --group=dapp",
"dapp/signtxn": "jest --group=dapp/signtxn",
"dapp/groups": "jest --group=dapp/groups",
"ledger": "jest --group=ledger",
"coveragetest": "jest --coverage=true --coverageDirectory ../test-project/coverage --projects ../crypto ../extension ../storage ../common ../dapp --runInBand && bash -c \"start chrome \"$(realpath ./coverage/lcov-report/index.html\"\")",
"test": "jest -i --group=-github"
"test": "jest -i --group=-github --group=-ledger"
}
}
40 changes: 40 additions & 0 deletions packages/test-project/tests/common/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ async function openAccountDetails(account) {
await extensionPage.click('#showDetails');
}

async function verifyUITransaction(id, title, address) {
const txSelector = `[data-transaction-id="${id}"]`;
await extensionPage.waitForSelector(txSelector);
await extensionPage.click(txSelector);
await expect(extensionPage.$eval('#txTitle', (e) => e.innerText)).resolves.toBe(title);
await expect(
extensionPage.$eval('.modal.is-active [data-transaction-id]', (e) => e.dataset['transactionId'])
).resolves.toBe(id);
await expect(
extensionPage.$eval(
'.modal.is-active [data-transaction-sender]',
(e) => e.dataset['transactionSender']
)
).resolves.toBe(address);
await closeModal();
}

async function openSettingsMenu() {
await extensionPage.waitForSelector('#openSettings');
await extensionPage.click('#openSettings');
Expand Down Expand Up @@ -63,6 +80,15 @@ async function inputPassword() {
await extensionPage.waitForFunction(() => !document.querySelector('#authButton'));
}

async function getOpenedTab() {
await dappPage.waitForTimeout(1500);
const pages = await browser.pages();
const tab = pages[pages.length - 1];

tab.on('console', (msg) => console.log('OPENED TAB LOG:', msg.text()));
return tab;
}

// Dapp Helpers
async function getPopup() {
await dappPage.waitForTimeout(1500);
Expand Down Expand Up @@ -155,6 +181,16 @@ function decodeAddress(address) {
return algosdk.decodeAddress(address);
}

function buildSdkTx(tx) {
return new algosdk.Transaction(tx);
}

function prepareWalletTx(tx) {
return {
txn: byteArrayToBase64(tx.toByte()),
};
}

function mergeMultisigTransactions(signedTransactionsArray) {
const convertedArray = signedTransactionsArray.map((s) => base64ToByteArray(s.blob));
const mergedTx = algosdk.mergeMultisigTransactions(convertedArray);
Expand All @@ -176,11 +212,13 @@ module.exports = {
openExtension,
selectAccount,
openAccountDetails,
verifyUITransaction,
openSettingsMenu,
closeSettingsMenu,
goBack,
closeModal,
inputPassword,
getOpenedTab,
getPopup,
getLedgerSuggestedParams,
sendTransaction,
Expand All @@ -190,6 +228,8 @@ module.exports = {
decodeBase64Blob,
encodeAddress,
decodeAddress,
buildSdkTx,
prepareWalletTx,
mergeMultisigTransactions,
appendSignToMultisigTransaction,
};
2 changes: 1 addition & 1 deletion packages/test-project/tests/common/tests.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { wallet, extension } = require('./constants');
const { openAccountDetails, goBack, closeModal, inputPassword, getPopup } = require('./helpers');
const { openAccountDetails, goBack, inputPassword, getPopup, closeModal } = require('./helpers');

// Common Tests
function WelcomePage() {
Expand Down
20 changes: 4 additions & 16 deletions packages/test-project/tests/dapp-groups.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,15 @@ const { accounts } = require('./common/constants');
const {
openExtension,
getLedgerSuggestedParams,
byteArrayToBase64,
buildSdkTx,
prepareWalletTx,
} = require('./common/helpers');
const { CreateWallet, ConnectAlgoSigner, ImportAccount } = require('./common/tests');

const account = accounts.ui;

let ledgerParams;

const buildSdkTx = (tx) => {
return new algosdk.Transaction(tx);
};

const prepareWalletTx = (tx) => {
return {
txn: byteArrayToBase64(tx.toByte()),
};
};

async function signTxnGroups(transactionsToSign) {
await dappPage.waitForTimeout(2000);
const signedGroups = await dappPage.evaluate(
Expand Down Expand Up @@ -65,16 +56,13 @@ describe('Wallet Setup', () => {
});

CreateWallet();

ImportAccount(account);
});

describe('dApp Setup', () => {
ConnectAlgoSigner();

test('Get TestNet params', async () => {
ledgerParams = await getLedgerSuggestedParams();
});

ImportAccount(account);
});

describe('Group of Groups Use cases', () => {
Expand Down
24 changes: 6 additions & 18 deletions packages/test-project/tests/dapp-signtxn.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ const {
openExtension,
getPopup,
getLedgerSuggestedParams,
byteArrayToBase64,
decodeBase64Blob,
buildSdkTx,
prepareWalletTx,
} = require('./common/helpers');
const { CreateWallet, ConnectAlgoSigner, ImportAccount } = require('./common/tests');

Expand All @@ -22,16 +23,6 @@ const account2 = msigAccount.subaccounts[1];
let ledgerParams;
let unsignedTransactions = [];

const buildSdkTx = (tx) => {
return new algosdk.Transaction(tx);
};

const prepareWalletTx = (tx) => {
return {
txn: byteArrayToBase64(tx.toByte()),
};
};

async function signTxn(transactionsToSign, testFunction) {
const timestampedName = `popupTest-${new Date().getTime().toString()}`;
if (testFunction) {
Expand Down Expand Up @@ -82,17 +73,14 @@ describe('Wallet Setup', () => {
});

CreateWallet();

ImportAccount(account1);
ImportAccount(account2);
});

describe('dApp Connecting', () => {
ConnectAlgoSigner();

test('Get TestNet params', async () => {
ledgerParams = await getLedgerSuggestedParams();
});

ImportAccount(account1);
ImportAccount(account2);
});

describe('Error Use cases', () => {
Expand Down Expand Up @@ -239,7 +227,7 @@ describe('Multisig Transaction Use cases', () => {
unsignedTransactions[0].signers = [account1.address];
const signedTransactions = await signTxn(unsignedTransactions);

// Verify correctsignature is added
// Verify correct signature is added
const decodedTransaction = decodeBase64Blob(signedTransactions[0].blob);
expect(decodedTransaction).toHaveProperty('txn');
expect(decodedTransaction).toHaveProperty('msig');
Expand Down
Loading

0 comments on commit 8869b6d

Please sign in to comment.