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 #312 from PureStake/develop
Browse files Browse the repository at this point in the history
Patch 1.6.6
  • Loading branch information
Jan Marcano authored Oct 13, 2021
2 parents 31cb57e + 002c585 commit 87c88e8
Show file tree
Hide file tree
Showing 25 changed files with 514 additions and 77 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ Added ability to use a Ledger device to add public addresses into AlgoSigner and
- Each inner array should still contain transactions **belonging to a same group**
- Updated error message when providing an incorrect format of transactions to reflect this change

### 1.6.6 Patch
- Support for Ledger device signing v2 transactions
- Added check URLs button to Network Configuration
- Support for Inner Transactions Display
- Fix for custom networks with pathnames
- Fix for rare infinite loop locking extension sign page
- Fix for display of estimated fee for Ledger device sign

## New Users

- Watch [Getting Started with AlgoSigner](https://youtu.be/tG-xzG8r770)
Expand Down
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.6.5",
"version": "1.6.6",
"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.6.5",
"version": "1.6.6",
"author": "https://developer.purestake.io",
"description": "Common library functions for AlgoSigner.",
"repository": "https://github.com/PureStake/algosigner",
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/messaging/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export enum JsonRpcMethod {
SignSendTransaction = 'sign-send-transaction',
ChangeLedger = 'change-ledger',
SaveNetwork = 'save-network',
CheckNetwork = 'check-network',
DeleteNetwork = 'delete-network',
GetLedgers = 'get-ledgers',

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.6.5",
"version": "1.6.6",
"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.6.5",
"version": "1.6.6",
"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.6.5",
"version": "1.6.6",
"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.6.5",
"version": "1.6.6",
"author": "https://developer.purestake.io",
"repository": "https://github.com/PureStake/algosigner",
"license": "MIT",
Expand Down
32 changes: 26 additions & 6 deletions packages/extension/src/background/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging from '@algosigner/common/logging';
import { LedgerTemplate } from '@algosigner/common/types/ledgers';
import { Ledger, Backend, API } from './messaging/types';
import { parseUrlServerAndPort } from './utils/networkUrlParser';
Expand Down Expand Up @@ -49,8 +50,8 @@ export class Settings {
return injectedNetworks;
}

private static setInjectedHeaders(ledger: LedgerTemplate) {
if (!this.backend_settings.InjectedNetworks[ledger.name]) {
private static setInjectedHeaders(ledger: LedgerTemplate, isCheckOnly?: boolean) {
if (!this.backend_settings.InjectedNetworks[ledger.name] && !isCheckOnly) {
console.log('Error: Ledger headers can not be updated. Ledger not available.');
return;
}
Expand Down Expand Up @@ -93,23 +94,34 @@ export class Settings {
// Setup port splits for algod and indexer - used in sandbox installs
const parsedAlgodUrlObj = parseUrlServerAndPort(ledger.algodUrl)
const parsedIndexerUrlObj = parseUrlServerAndPort(ledger.indexerUrl);

this.backend_settings.InjectedNetworks[ledger.name][API.Algod] = {

// Add algod links
const injectedAlgod = {
url: parsedAlgodUrlObj.server || `${defaultUrl}/algod`,
port: parsedAlgodUrlObj.port,
apiKey: headersAlgod || headers,
headers: headersAlgod || headers,
};

// Add the indexer links
this.backend_settings.InjectedNetworks[ledger.name][API.Indexer] = {
const injectedIndexer = {
url: parsedIndexerUrlObj.server || `${defaultUrl}/indexer`,
port: parsedIndexerUrlObj.port,
apiKey: headersIndexer || headers,
headers: headersIndexer || headers,
};

this.backend_settings.InjectedNetworks[ledger.name].headers = headers;
if (isCheckOnly) {
return {
'algod': injectedAlgod,
'indexer': injectedIndexer
}
}
else {
this.backend_settings.InjectedNetworks[ledger.name][API.Algod] = injectedAlgod;
this.backend_settings.InjectedNetworks[ledger.name][API.Indexer] = injectedIndexer;
this.backend_settings.InjectedNetworks[ledger.name].headers = headers;
}
}

public static addInjectedNetwork(ledger: LedgerTemplate) {
Expand All @@ -120,6 +132,7 @@ export class Settings {
};

this.setInjectedHeaders(ledger);
logging.log(`Added Network:\n${JSON.stringify(this.backend_settings.InjectedNetworks[ledger.name],null,1)}`,2);
}

public static updateInjectedNetwork(updatedLedger: LedgerTemplate) {
Expand All @@ -131,6 +144,8 @@ export class Settings {
this.backend_settings.InjectedNetworks[updatedLedger.name].indexerUrl =
updatedLedger.indexerUrl;
this.setInjectedHeaders(updatedLedger);

logging.log(`Updated Network:\n${JSON.stringify(this.backend_settings.InjectedNetworks[updatedLedger.name],null,1)}`,2);
}

public static getBackendParams(ledger: string, api: API) {
Expand All @@ -152,4 +167,9 @@ export class Settings {
headers: this.backend_settings.InjectedNetworks[ledger][api].headers,
};
}

public static checkNetwork(ledger: LedgerTemplate) {
const networks = this.setInjectedHeaders(ledger, true);
return networks;
}
}
10 changes: 10 additions & 0 deletions packages/extension/src/background/messaging/internalMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,16 @@ export class InternalMethods {
return true;
}

public static [JsonRpcMethod.CheckNetwork](request: any, sendResponse: Function) {
try {
const networks = Settings.checkNetwork(request.body.params)
sendResponse(networks);
}
catch (e) {
sendResponse({ error: e.message });
}
}

public static [JsonRpcMethod.SaveNetwork](request: any, sendResponse: Function) {
try {
// If we have a passphrase then we are modifying.
Expand Down
Loading

0 comments on commit 87c88e8

Please sign in to comment.