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 #140 from PureStake/master
Browse files Browse the repository at this point in the history
Release 1.1.0
  • Loading branch information
purestaketdb authored Nov 3, 2020
2 parents 73c50d4 + 32f65e9 commit 6b65bf4
Show file tree
Hide file tree
Showing 103 changed files with 4,524 additions and 1,050 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# 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]
schedule:
- cron: '0 16 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['javascript']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
4 changes: 2 additions & 2 deletions .github/workflows/zip-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deployment
on:
release:
types:
- created
- released
jobs:
test_zip_upload:
runs-on: ubuntu-latest
Expand All @@ -27,7 +27,7 @@ jobs:
id: zip_up
run: zip -r AlgoSigner.zip ./dist/*
- name: Upload
uses: actions/upload-release-asset@v1.0.1
uses: actions/upload-release-asset@v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,37 @@ _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.1.0 Update
The latest release introduces several key new features for users and dApp developers.

### Asset Support in the UI
Assets have always been displayed in the UI, now you may find new assets, opt-in to them, and transfer them right in the UI.

### Asset Support for dApps
dApps were previously able to send in basic asset transactions to be signed by AlgoSigner. Support has now been added for all asset transaction types with accompanying UI notices.

* Clawback added
* Destroy capability allowed for `acfg`
* Close-to supported in `axfer`

### Application Transaction Support for dApps
dApp developers may now send in application transactions to be signed. This support is new and subject to change in subsequent releases. Please read the updated [dApp Integration Guide](docs/dApp-integration.md) for instructions on working with these transaction types.

### Additional dApp support

* Support has been enabled for `close-to` transactions.
* Transaction validation errors will now provide more detailed messages on causes

### UI Transactions
With the addition of support for `close-to` transactions, new warning messages will display in the UI when dApps send in pay transactions that are potentially dangerous.

The signing window will also now reflect better the ledger the dApp is asking the user to sign a transaction for. A new label is present in dark blue for Testnet and orange for Mainnet

### Sample dApp and dApp Tests

* Signing app - New sample dApp for [demonstrating transaction signing](https://purestake.github.io/algosigner-dapp-example/tx-test/signTesting.html)
* Updates to the [existing sample dApp](https://purestake.github.io/algosigner-dapp-example/) demonstrating pending lookup and asset search

## Decentralized Applications
As a browser extension, AlgoSigner opens the door for developers to build DeFi applications on Algorand by providing a secure way to add transaction capabilities. This enables developers to initiate transactions and accept ALGOs seamlessly, without jeopardizing the security of their users’ secrets.

Expand Down
5 changes: 3 additions & 2 deletions docs/dApp-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,14 @@ AlgoSigner.indexer({
Send a transaction object, conforming to the Algorand JS SDK, to AlgoSigner for approval. The Network is determined from the 'genesis-id' property. If approved, the response is a signed transaction object, with the binary blob field base64 encoded to prevent transmission issues.

#### Transaction Requirements
- Must have a valid type ('pay', 'keyreg', 'acfg', 'axfer', 'afrz')
- Must have a valid type ('pay', 'keyreg', 'acfg', 'axfer', 'afrz', 'appl')
- Must not have additional unknown fields
- Must not have any value in the 'rekey' field
- When provided, address 'to' must be a valid address
- Numeric fields must have values that are considered safe and non-negative
- Fees above 1000 Micro Algos and any usage of 'close' fields ('AssetCloseTo' or 'CloseRemainderTo') will have internal warnings created for display purposes
- Fees above 1000 Micro Algos and any usage of 'close' fields ('CloseRemainderTo') will have internal warnings created for display purposes
- Note field must be a string (you may encrypt it) - not an Uint8, to prevent transmission errors
- Application transactions must have the appApprovalProgram, appClearProgram, and elements of the appArgs array be 64bit encoded strings, which will decode and cast back to uint8

These restrictions can be seen in [this link](https://github.com/PureStake/algosigner/blob/master/packages/extension/src/background/utils/validator.ts).

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.0.1",
"version": "1.1.0",
"author": "https://developer.purestake.io",
"description": "Sign Algorand transactions in your browser with PureStake.",
"keywords": [
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.0.1",
"version": "1.1.0",
"author": "https://developer.purestake.io",
"description": "Common library functions for AlgoSigner.",
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/common/src/interfaces/acfg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IBaseTx } from "./baseTx";
///
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.
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.
Expand All @@ -16,5 +16,5 @@ export interface IAssetConfigTx extends IBaseTx {
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.
assetClawback?: string, //Address "c" The address of the account that can clawback holdings of this asset. If empty, clawback is not permitted.
}
19 changes: 19 additions & 0 deletions packages/common/src/interfaces/acfg_create.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { IBaseTx } from "./baseTx";

///
// Mapping interface of allowable fields for acfg create transactions.
///
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.
}
9 changes: 9 additions & 0 deletions packages/common/src/interfaces/acfg_destroy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { IBaseTx } from "./baseTx";

///
// Mapping interface of allowable fields for acfg destroy transactions.
///
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.
}
38 changes: 37 additions & 1 deletion packages/common/src/interfaces/appl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
import { IBaseTx } from "./baseTx";
///
// Mapping interface of allowable fields for appl transactions.
///
export interface IAppl {}
export interface IApplTx extends IBaseTx {
// NOTE: Most fields are remapped in the algosdk - The comments indicate where they will be mapped too.
type: string, //"appl"

//apid: number, //uint64 "apid" ID of the application being configured or empty if creating.
appIndex?: any,

//apan: number, //uint64 "apan" Defines what additional actions occur with the transaction. See the OnComplete section of the TEAL spec for details.
appOnComplete?: any,

//apat?: string, //Address "apat" List of accounts in addition to the sender that may be accessed from the application's approval-program and clear-state-program.
appAccounts?: any, //Expects Array[Addresses]

//apap?: string, //Address "apap" Logic executed for every application transaction, except when on-completion is set to "clear". It can read and write global state for the application, as well as account-specific local state. Approval programs may reject the transaction.
appApprovalProgram?: any,

//apaa?: any, //byte[] "apaa" Transaction specific arguments accessed from the application's approval-program and clear-state-program.
appArgs?: any, //Array: Performs a Buffer.from() for each element

//apsu?: string, //Address "apsu" Logic executed for application transactions with on-completion set to "clear". It can read and write global state for the application, as well as account-specific local state. Clear state programs cannot reject the transaction.
appClearProgram?: any,

//apfa?: string, //Address "apfa" Lists the applications in addition to the application-id whose global states may be accessed by this application's approval-program and clear-state-program. The access is read-only.
appForeignApps?: any,

//apas?: string, //Address "apas" Lists the assets whose AssetParams may be accessed by this application's approval-program and clear-state-program. The access is read-only.
appForeignAssets?: any

//apgs?: any, //StateSchema "apgs" Holds the maximum number of global state values defined within a StateSchema object.
appGlobalInts?: any,
appGlobalByteSlices?: any,

//apls?: any, //StateSchema "apls" Holds the maximum number of local state values defined within a StateSchema object.
appLocalInts?: any,
appLocalByteSlices?: any,
}
6 changes: 2 additions & 4 deletions packages/common/src/interfaces/axfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import { IBaseTx } from "./baseTx";
export interface IAssetTransferTx extends IBaseTx {
type: string, //"axfer"
assetIndex: number, //uint64 "xaid" The unique ID of the asset to be transferred.
amount?: number, //uint64 "aamt" The amount of the asset to be transferred. A zero amount transferred to self allocates that asset in the account's Asset map.
amount: number, //uint64 "aamt" The amount of the asset to be transferred. A zero amount transferred to self allocates that asset in the account's Asset map.
to: string, //Address "arcv" The recipient of the asset transfer.
assetCloseTo?: string, //Address "aclose" Specify this field to remove the asset holding from the sender account and reduce the account's minimum balance.

//For clawback the sender of this transaction must be the clawback account specified in the asset configuration
closeRemainderTo?: string, //Address "aclose" Specify this field to remove the asset holding from the sender account and reduce the account's minimum balance.
}
11 changes: 11 additions & 0 deletions packages/common/src/interfaces/axfer_accept.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { IBaseTx } from "./baseTx";

///
// Mapping interface of allowable fields for axfer accept transactions.
///
export interface IAssetAcceptTx extends IBaseTx {
type: string, //"axfer"
assetIndex: number, //uint64 "xaid" The unique ID of the asset to be transferred.
amount?: number, //uint64 "aamt" The amount of the asset to be transferred. A zero amount transferred to self allocates that asset in the account's Asset map.
to: string, //Address "arcv" The recipient of the asset transfer. Must be self for Asset Accept.
}
13 changes: 13 additions & 0 deletions packages/common/src/interfaces/axfer_clawback.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { IBaseTx } from "./baseTx";

///
// Mapping interface of allowable fields for axfer transactions.
///
export interface IAssetClawbackTx extends IBaseTx {
type: string, //"axfer"
assetIndex: number, //uint64 "xaid" The unique ID of the asset to be transferred.
amount: number, //uint64 "aamt" The amount of the asset to be transferred. A zero amount transferred to self allocates that asset in the account's Asset map.
closeRemainderTo?: string, //Address "aclose" Specify this field to remove the asset holding from the sender account and reduce the account's minimum balance.
assetRevocationTarget: string, //Address "asnd" The address from which the funds will be withdrawn.
to: string, //Address
}
4 changes: 2 additions & 2 deletions packages/common/src/interfaces/baseTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// Mapping interface of allowable base fields for transactions.
///
export interface IBaseTx {
//ledger?: string,
from?: string, //Address "snd" The address of the account that pays the fee and amount. (Auto set by algosdk as the from.publicKey)
from: string, //Address "snd" The address of the account that pays the fee and amount. (Auto set by algosdk as the from.publicKey)
fee: number, //uint64 "fee" Paid by the sender to the FeeSink to prevent denial-of-service. The minimum fee on Algorand is currently 1000 microAlgos.
firstRound: number, //uint64 "fv" The first round for when the transaction is valid. If the transaction is sent prior to this round it will be rejected by the network.
lastRound: number, //uint64 "lv" The ending round for which the transaction is valid. After this round, the transaction will be rejected by the network.
Expand All @@ -13,5 +12,6 @@ export interface IBaseTx {
group?: any, //[32]byte "grp" The group specifies that the transaction is part of a group and, if so, specifies the hash of the transaction group. Assign a group ID to a transaction through the workflow described in the Atomic Transfers Guide.
lease?: any, //[32]byte "lx" A lease enforces mutual exclusion of transactions. If this field is nonzero, then once the transaction is confirmed, it acquires the lease identified by the (Sender, Lease) pair of the transaction until the LastValid round passes. While this transaction possesses the lease, no other transaction specifying this lease can be confirmed. A lease is often used in the context of Algorand Smart Contracts to prevent replay attacks. (Buffer is created from the provided value)
//txType //string "type" Specifies the type of transaction. This value is automatically generated using any of the developer tools.
reKeyTo?: any, //string "rekey" Remapped to reKeyTo for algosdk alignment
}

Loading

0 comments on commit 6b65bf4

Please sign in to comment.