This repository has been archived by the owner on Jun 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #223 from PureStake/master
1.4.2 Hotfix to release
- Loading branch information
Showing
45 changed files
with
422 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,5 @@ | |
.DS_Store | ||
**/coverage | ||
packages/crypto | ||
packages/common | ||
**/tsconfig.json | ||
.github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
} |
Oops, something went wrong.