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 #223 from PureStake/master
Browse files Browse the repository at this point in the history
1.4.2 Hotfix to release
  • Loading branch information
purestaketdb authored May 10, 2021
2 parents e907ea1 + 5851a65 commit d0f18d4
Show file tree
Hide file tree
Showing 45 changed files with 422 additions and 340 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
# or to provide custom queries or build logic.
name: "CodeQL"

on:
push:
branches: [develop, master, release]
pull_request:
# The branches below must be a subset of the branches above
branches: [develop, master, release]
schedule:
- cron: '0 16 * * 1'
on: pull_request

jobs:
analyze:
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
.DS_Store
**/coverage
packages/crypto
packages/common
**/tsconfig.json
.github
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ _This is the preferred solution for end-users, updates will be automatically ins

Developers working with dApps may also install directly from the release package, or by downloading the project and building it.

## 1.4.2 Update

Minor release:

- Limit timeouts with accounts that have deleted assets.

## 1.4.1 Update

Minor release to address some bugs and usability issues:
Expand All @@ -20,7 +26,7 @@ Minor release to address some bugs and usability issues:

## 1.4.0 Update

- Beta support for adding custom networks within AlgoSigner (development networks, BetaNet, etc.).
- Beta support for adding custom networks within AlgoSigner (development networks, BetaNet, etc.). [More information on adding a new Network](docs/add-network.md)
- Navigation menu improvements
- Logout!

Expand Down
67 changes: 67 additions & 0 deletions docs/add-network.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Adding a New Network to AlgoSigner

AlgoSigner has built in access to the Algorand MainNet and TestNet. Settings for these networks are locked in the installed extension, although developers may modify the source code themselves and build a version with alternate settings.

Users may add additional networks to AlgoSigner through the extension settings. For example adding the Algorand BetaNet or a local network created by the [Algorand Sandbox](https://github.com/algorand/sandbox).

## Requirements

To add a new network you will need:

- Algod URL
- Indexer URL
- Network Id, which must be unique for your networks. This is listed as the `genesis-id` from the Algod API call "GET /versions" or from the the CLI command "goal node status"

- API Key, potenitally optional depending on API hosting

## Setup

- Open the extension and select the gear icon in the top right

![Network](network_config_images/network_gear_home.png)

- Select Network Configuration

![Network](network_config_images/settings_open.png)

- Select New Network

![Network](network_config_images/network_config_open.png)

### Enter Settings

![Network](network_config_images/network_add_details.png)

- Give the Network a name to identify it
- Add the unique Network Id (genesis-id)
- Add the URLs for Algod and Indexer, including port if necessary
- For the Network headers there are choices, depending on your API provider, see below for configuration details
- Save the new Network
- Add accounts to your new Network

Note, there is not yet a test feature for networks, but one is planned.

### Network Headers

For an instance of Algod that uses the X-Algo-API-Token, just enter it as text into the field.

![Network](network_config_images/network_headers.png)

To use a custom API key value in the header of each request, for example for the PureStake API service, construct a JSON object with key value pairs to be added to the request, broke out by Algod or Indexer, for example:

```JSON
{
"Algod":
{
"x-api-key": "xxxxxxxxx"
},
"Indexer":
{
"x-api-key": "xxxxxxxxx"
}
}
```

Note, JSON object will need to be flattended to a single line.

![Network](network_config_images/network_headers_json.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/network_config_images/network_gear_home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/network_config_images/network_headers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/network_config_images/settings_open.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.4.1",
"version": "1.4.2",
"author": "https://developer.purestake.io",
"description": "Sign Algorand transactions in your browser with PureStake.",
"keywords": [
Expand Down
21 changes: 7 additions & 14 deletions packages/common/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
module.exports = {
"roots": [
"<rootDir>/src"
],
"testMatch": [
"**/__tests__/**/*.+(ts|tsx|js)",
"**/?(*.)+(spec|test).+(ts|tsx|js)"
],
"transform": {
"^.+\\.(ts|tsx)$": "ts-jest"
},
setupFiles: [
"jest-webextension-mock"
]
}
roots: ['<rootDir>/src'],
testMatch: ['**/__tests__/**/*.+(ts|tsx|js)', '**/?(*.)+(spec|test).+(ts|tsx|js)'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
setupFiles: ['jest-webextension-mock'],
};
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.4.1",
"version": "1.4.2",
"author": "https://developer.purestake.io",
"description": "Common library functions for AlgoSigner.",
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/common/src/chrome.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//@ts-ignore
export const extensionBrowser = chrome || undefined; //|| browser
// TODO: This file needs to handle the chrome browser context or other browers as well.
export const extensionBrowser = chrome || undefined; //|| browser
// TODO: This file needs to handle the chrome browser context or other browers as well.
24 changes: 11 additions & 13 deletions packages/common/src/common.test.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
import { extensionBrowser } from './chrome';
import { logging } from './logging';
import { isFromExtension } from './utils';
import { RequestErrors,Transaction,TAccount,Note,Amount } from './types';

import { RequestErrors, Transaction, TAccount, Note, Amount } from './types';

test('Test chrome reference', () => {
//@ts-ignore
expect(extensionBrowser).toBe(chrome);
//@ts-ignore
expect(extensionBrowser).toBe(chrome);
});

test('Logging test', () => {
expect(typeof logging.log).toBe("function");
expect(typeof logging.log).toBe('function');
});

test('Test extension parts', () => {
extensionBrowser.runtime.id = '12345';
expect(isFromExtension('chrome-extension://12345')).toBe(true);
extensionBrowser.runtime.id = '12345';
expect(isFromExtension('chrome-extension://12345')).toBe(true);
});

test('Type - RequestErrors undefined test', () => {
expect(RequestErrors.Undefined).toBe('[RequestErrors.Undefined] An undefined error occurred.');
expect(RequestErrors.Undefined).toBe('[RequestErrors.Undefined] An undefined error occurred.');
});

test('Type - Transaction', () => {
expect({amount: 1, from:"AAA", to:"BBB"} as Transaction).toBeInstanceOf(Object);
expect({ amount: 1, from: 'AAA', to: 'BBB' } as Transaction).toBeInstanceOf(Object);
});

test('Type - TAccount', () => {
expect('string' as TAccount).toBe('string');
expect('string' as TAccount).toBe('string');
});

test('Type - Note', () => {
expect('string' as Note).toBe('string');
expect('string' as Note).toBe('string');
});

test('Type - Amount', () => {
expect(12345 as Amount).toBe(12345);
expect(12345 as Amount).toBe(12345);
});

30 changes: 16 additions & 14 deletions packages/common/src/interfaces/acfg.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import { IBaseTx } from "./baseTx";
import { IBaseTx } from './baseTx';

///
// Mapping interface of allowable fields for acfg transactions.
///

// prettier-ignore
export interface IAssetConfigTx extends IBaseTx {
type: string, //"acfg"
assetIndex: number, //uint64 "caid" For re-configure or destroy transactions, this is the unique asset ID. On asset creation, the ID is set to zero.
assetTotal?: number, //uint64 "t" The total number of base units of the asset to create. This number cannot be changed.
assetDecimals?: number, //uint32 "dc" The number of digits to use after the decimal point when displaying the asset. If 0, the asset is not divisible. If 1, the base unit of the asset is in tenths. If 2, the base unit of the asset is in hundredths.
assetDefaultFrozen?: boolean, //bool "df" True to freeze holdings for this asset by default.
assetUnitName?: string, //string "un" The name of a unit of this asset. Supplied on creation. Example: USDT
assetName?: string, //string "an" The name of the asset. Supplied on creation. Example: Tether
assetURL?: string, //string "au" Specifies a URL where more information about the asset can be retrieved. Max size is 32 bytes.
assetMetadataHash?: any, //[]byte "am" This field is intended to be a 32-byte hash of some metadata that is relevant to your asset and/or asset holders. The format of this metadata is up to the application. This field can only be specified upon creation. An example might be the hash of some certificate that acknowledges the digitized asset as the official representation of a particular real-world asset.
assetManager?: string, //Address "m" The address of the account that can manage the configuration of the asset and destroy it.
assetReserve?: string, //Address "r" The address of the account that holds the reserve (non-minted) units of the asset. This address has no specific authority in the protocol itself. It is used in the case where you want to signal to holders of your asset that the non-minted units of the asset reside in an account that is different from the default creator account (the sender).
assetFreeze?: string, //Address "f" The address of the account used to freeze holdings of this asset. If empty, freezing is not permitted.
assetClawback?: string, //Address "c" The address of the account that can clawback holdings of this asset. If empty, clawback is not permitted.
type: string, //"acfg"
assetIndex: number, //uint64 "caid" For re-configure or destroy transactions, this is the unique asset ID. On asset creation, the ID is set to zero.
assetTotal?: number, //uint64 "t" The total number of base units of the asset to create. This number cannot be changed.
assetDecimals?: number, //uint32 "dc" The number of digits to use after the decimal point when displaying the asset. If 0, the asset is not divisible. If 1, the base unit of the asset is in tenths. If 2, the base unit of the asset is in hundredths.
assetDefaultFrozen?: boolean, //bool "df" True to freeze holdings for this asset by default.
assetUnitName?: string, //string "un" The name of a unit of this asset. Supplied on creation. Example: USDT
assetName?: string, //string "an" The name of the asset. Supplied on creation. Example: Tether
assetURL?: string, //string "au" Specifies a URL where more information about the asset can be retrieved. Max size is 32 bytes.
assetMetadataHash?: any, //[]byte "am" This field is intended to be a 32-byte hash of some metadata that is relevant to your asset and/or asset holders. The format of this metadata is up to the application. This field can only be specified upon creation. An example might be the hash of some certificate that acknowledges the digitized asset as the official representation of a particular real-world asset.
assetManager?: string, //Address "m" The address of the account that can manage the configuration of the asset and destroy it.
assetReserve?: string, //Address "r" The address of the account that holds the reserve (non-minted) units of the asset. This address has no specific authority in the protocol itself. It is used in the case where you want to signal to holders of your asset that the non-minted units of the asset reside in an account that is different from the default creator account (the sender).
assetFreeze?: string, //Address "f" The address of the account used to freeze holdings of this asset. If empty, freezing is not permitted.
assetClawback?: string, //Address "c" The address of the account that can clawback holdings of this asset. If empty, clawback is not permitted.
}
30 changes: 16 additions & 14 deletions packages/common/src/interfaces/acfg_create.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { IBaseTx } from "./baseTx";
import { IBaseTx } from './baseTx';

///
// Mapping interface of allowable fields for acfg create transactions.
///

// prettier-ignore
export interface IAssetCreateTx extends IBaseTx {
type: string, //"acfg"
assetTotal: number, //uint64 "t" The total number of base units of the asset to create. This number cannot be changed.
assetDecimals: number, //uint32 "dc" The number of digits to use after the decimal point when displaying the asset. If 0, the asset is not divisible. If 1, the base unit of the asset is in tenths. If 2, the base unit of the asset is in hundredths.
assetDefaultFrozen?: boolean, //bool "df" True to freeze holdings for this asset by default.
assetUnitName?: string, //string "un" The name of a unit of this asset. Supplied on creation. Example: USDT
assetName?: string, //string "an" The name of the asset. Supplied on creation. Example: Tether
assetURL?: string, //string "au" Specifies a URL where more information about the asset can be retrieved. Max size is 32 bytes.
assetMetadataHash?: any, //[]byte "am" This field is intended to be a 32-byte hash of some metadata that is relevant to your asset and/or asset holders. The format of this metadata is up to the application. This field can only be specified upon creation. An example might be the hash of some certificate that acknowledges the digitized asset as the official representation of a particular real-world asset.
assetManager?: string, //Address "m" The address of the account that can manage the configuration of the asset and destroy it.
assetReserve?: string, //Address "r" The address of the account that holds the reserve (non-minted) units of the asset. This address has no specific authority in the protocol itself. It is used in the case where you want to signal to holders of your asset that the non-minted units of the asset reside in an account that is different from the default creator account (the sender).
assetFreeze?: string, //Address "f" The address of the account used to freeze holdings of this asset. If empty, freezing is not permitted.
assetClawback?: string, //Address "c" The address of the account that can clawback holdings of this asset. If empty, clawback is not permitted.
}
type: string, //"acfg"
assetTotal: number, //uint64 "t" The total number of base units of the asset to create. This number cannot be changed.
assetDecimals: number, //uint32 "dc" The number of digits to use after the decimal point when displaying the asset. If 0, the asset is not divisible. If 1, the base unit of the asset is in tenths. If 2, the base unit of the asset is in hundredths.
assetDefaultFrozen?: boolean, //bool "df" True to freeze holdings for this asset by default.
assetUnitName?: string, //string "un" The name of a unit of this asset. Supplied on creation. Example: USDT
assetName?: string, //string "an" The name of the asset. Supplied on creation. Example: Tether
assetURL?: string, //string "au" Specifies a URL where more information about the asset can be retrieved. Max size is 32 bytes.
assetMetadataHash?: any, //[]byte "am" This field is intended to be a 32-byte hash of some metadata that is relevant to your asset and/or asset holders. The format of this metadata is up to the application. This field can only be specified upon creation. An example might be the hash of some certificate that acknowledges the digitized asset as the official representation of a particular real-world asset.
assetManager?: string, //Address "m" The address of the account that can manage the configuration of the asset and destroy it.
assetReserve?: string, //Address "r" The address of the account that holds the reserve (non-minted) units of the asset. This address has no specific authority in the protocol itself. It is used in the case where you want to signal to holders of your asset that the non-minted units of the asset reside in an account that is different from the default creator account (the sender).
assetFreeze?: string, //Address "f" The address of the account used to freeze holdings of this asset. If empty, freezing is not permitted.
assetClawback?: string, //Address "c" The address of the account that can clawback holdings of this asset. If empty, clawback is not permitted.
}
10 changes: 6 additions & 4 deletions packages/common/src/interfaces/acfg_destroy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { IBaseTx } from "./baseTx";
import { IBaseTx } from './baseTx';

///
// Mapping interface of allowable fields for acfg destroy transactions.
///

// prettier-ignore
export interface IAssetDestroyTx extends IBaseTx {
type: string, //"acfg"
assetIndex: number, //uint64 "caid" For re-configure or destroy transactions, this is the unique asset ID. On asset creation, the ID is set to zero.
}
type: string, //"acfg"
assetIndex: number, //uint64 "caid" For re-configure or destroy transactions, this is the unique asset ID. On asset creation, the ID is set to zero.
}
12 changes: 7 additions & 5 deletions packages/common/src/interfaces/afrz.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { IBaseTx } from "./baseTx";
import { IBaseTx } from './baseTx';

///
// Mapping interface of allowable fields for afrz transactions.
///

// prettier-ignore
export interface IAssetFreezeTx extends IBaseTx {
type: string, //"afrz"
assetIndex: number, //uint64 "xaid" The unique ID of the asset to be transferred.
freezeAccount: string, //Address "fadd" The address of the account whose asset is being frozen or unfrozen.
freezeState: boolean //bool "afrz" True to freeze the asset.
type: string, //"afrz"
assetIndex: number, //uint64 "xaid" The unique ID of the asset to be transferred.
freezeAccount: string, //Address "fadd" The address of the account whose asset is being frozen or unfrozen.
freezeState: boolean //bool "afrz" True to freeze the asset.
}
Loading

0 comments on commit d0f18d4

Please sign in to comment.