Skip to content

Commit

Permalink
Merge branch 'release/v1.10.0b1'
Browse files Browse the repository at this point in the history
  • Loading branch information
algobarb committed Feb 15, 2022
2 parents 1e4990f + ee6fa0d commit 240759e
Show file tree
Hide file tree
Showing 40 changed files with 857 additions and 633 deletions.
47 changes: 39 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,45 @@
version: 2.1

workflows:
version: 2
test:
jobs:
- unit-test
- integration-test
- docset

jobs:
build:
machine:
image: "ubuntu-2004:202104-01"
unit-test:
docker:
- image: python:3.7.9
steps:
- checkout
- run: pip install -r requirements.txt
- run: black --check .
- run: python3 test_unit.py
integration-test:
machine:
image: "ubuntu-2004:202104-01"
steps:
- checkout
- run: make docker-test
docset:
docker:
# NOTE: We might eventually need Docker authentication here.
- image: cimg/python:3.9
steps:
- checkout
- run:
# NOTE: We might add caching at `pip` level here.
command: |
pip3 install -r requirements.txt
black --check .
set -e
python3 test_unit.py
make docker-test
pip install -r requirements.txt
cd docs
pip install -r requirements.txt
pip install sphinx sphinx_rtd_theme doc2dash
make html
doc2dash --name py-algo-sdk --index-page index.html --online-redirect-url https://py-algorand-sdk.readthedocs.io/en/latest/ _build/html
tar -czvf py-algo-sdk.docset.tar.gz py-algo-sdk.docset
mv py-algo-sdk.docset.tar.gz /tmp
- store_artifacts:
path: /tmp/py-algo-sdk.docset.tar.gz
destination: py-algo-sdk.docset.tar.gz
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,19 @@ venv.bak/
# vscode
.vscode/

# pycharm
.idea

# DS_Store
.DS_Store

# Testing files
*.feature
test/features
test-harness

# Build files
py-algorand-sdk-*

# Pycharm
.idea
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

# 1.10.0b1

## Added:

- New keyreg txn field (#244)
- C2C Feature and Testing (#268)
- Add App creator to account balances (#277)
- Add ABI and ATC to Sphinx (#289)

## Changed:

- Change __init__.py to include v2client import (#243)
- Updates to pipeline (#279)
- Add CircleCI build step to generate docsets (#285)
- revert to point testing harness to sdk testing's master branch (#288)
- Partially fix types for atomic transaction composer (#290)
- Update `langspec.json` for Teal6 (#292)

## 1.9.0
### Added

Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
UNITS = "@unit.abijson or @unit.algod or @unit.applications or @unit.atomic_transaction_composer or @unit.dryrun or @unit.feetest or @unit.indexer or @unit.indexer.logs or @unit.offline or @unit.rekey or @unit.transactions.keyreg or @unit.responses or @unit.responses.231 or @unit.tealsign or @unit.transactions or @unit.transactions.payment"
unit:
behave --tags="@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.applications or @unit.responses or @unit.transactions or @unit.transactions.payment or @unit.responses.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.atomic_transaction_composer" test -f progress2
behave --tags=$(UNITS) test -f progress2

INTEGRATIONS = "@abi or @algod or @applications or @applications.verified or @assets or @auction or @c2c or @compile or @dryrun or @dryrun.testing or @indexer or @indexer.231 or @indexer.applications or @kmd or @rekey or @send.keyregtxn or @send"
integration:
behave --tags="@algod or @assets or @auction or @kmd or @send or @template or @indexer or @indexer.applications or @rekey or @compile or @dryrun or @dryrun.testing or @applications or @applications.verified or @indexer.231 or @abi" test -f progress2
behave --tags=$(INTEGRATIONS) test -f progress2

docker-test:
./run_integration.sh
36 changes: 21 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
# py-algorand-sdk
[![Build Status](https://travis-ci.com/algorand/py-algorand-sdk.svg?branch=master)](https://travis-ci.com/algorand/py-algorand-sdk)
[![PyPI version](https://badge.fury.io/py/py-algorand-sdk.svg)](https://badge.fury.io/py/py-algorand-sdk)
[![Documentation Status](https://readthedocs.org/projects/py-algorand-sdk/badge/?version=latest&style=flat)](https://py-algorand-sdk.readthedocs.io/en/latest)

[![Build Status](https://travis-ci.com/algorand/py-algorand-sdk.svg?branch=master)](https://travis-ci.com/algorand/py-algorand-sdk)
[![PyPI version](https://badge.fury.io/py/py-algorand-sdk.svg)](https://badge.fury.io/py/py-algorand-sdk)
[![Documentation Status](https://readthedocs.org/projects/py-algorand-sdk/badge/?version=latest&style=flat)](https://py-algorand-sdk.readthedocs.io/en/latest)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

A python library for interacting with the Algorand network.

## Installation

Run ```$ pip3 install py-algorand-sdk``` to install the package.
Run `$ pip3 install py-algorand-sdk` to install the package.

Alternatively, choose a [distribution file](https://pypi.org/project/py-algorand-sdk/#files), and run ```$ pip3 install [file name]```.
Alternatively, choose a [distribution file](https://pypi.org/project/py-algorand-sdk/#files), and run `$ pip3 install [file name]`.

## SDK Development

Install dependencies
* `pip install -r requirements.txt`

- `pip install -r requirements.txt`

Run tests
* `make docker-test`

- `make docker-test`

Format code:
* `black .`

- `black .`

## Quick start

Expand Down Expand Up @@ -50,18 +54,18 @@ Follow the instructions in Algorand's [developer resources](https://developer.al

Before running [example.py](https://github.com/algorand/py-algorand-sdk/blob/master/examples/example.py), start kmd on a private network or testnet node:

```
$ ./goal kmd start -d [data directory]
```bash
./goal kmd start -d [data directory]
```

Next, create a wallet and an account:

```
$ ./goal wallet new [wallet name] -d [data directory]
```bash
./goal wallet new [wallet name] -d [data directory]
```

```
$ ./goal account new -d [data directory] -w [wallet name]
```bash
./goal account new -d [data directory] -w [wallet name]
```

Visit the [Algorand dispenser](https://bank.testnet.algorand.network/) and enter the account address to fund your account.
Expand All @@ -71,7 +75,9 @@ Next, in [tokens.py](https://github.com/algorand/py-algorand-sdk/blob/master/exa
You're now ready to run example.py!

## Documentation

Documentation for the Python SDK is available at [py-algorand-sdk.readthedocs.io](https://py-algorand-sdk.readthedocs.io/en/latest/).

## License
py-algorand-sdk is licensed under a MIT license. See the [LICENSE](https://github.com/algorand/py-algorand-sdk/blob/master/LICENSE) file for details.

py-algorand-sdk is licensed under an MIT license. See the [LICENSE](https://github.com/algorand/py-algorand-sdk/blob/master/LICENSE) file for details.
1 change: 1 addition & 0 deletions algosdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from . import template
from . import transaction
from . import util
from . import v2client
from . import wallet
from . import wordlist

Expand Down
38 changes: 21 additions & 17 deletions algosdk/atomic_transaction_composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import base64
import copy
from enum import IntEnum
from typing import Any, List, TypeVar, Union
from typing import Any, List, Optional, TypeVar, Union

from algosdk import abi, error
from algosdk.abi.address_type import AddressType
Expand Down Expand Up @@ -495,26 +495,27 @@ def execute(
raw_value = None
return_value = None
decode_error = None
tx_info = None

if i not in self.method_dict:
continue
# Return is void
if self.method_dict[i].returns.type == abi.Returns.VOID:
method_results.append(
ABIResult(
tx_id=tx_id,
raw_value=raw_value,
return_value=return_value,
decode_error=decode_error,
)
)
continue

# Parse log for ABI method return value
try:
resp = client.pending_transaction_info(tx_id)
confirmed_round = resp["confirmed-round"]
logs = resp["logs"] if "logs" in resp else []
tx_info = client.pending_transaction_info(tx_id)
if self.method_dict[i].returns.type == abi.Returns.VOID:
method_results.append(
ABIResult(
tx_id=tx_id,
raw_value=raw_value,
return_value=return_value,
decode_error=decode_error,
tx_info=tx_info,
)
)
continue

logs = tx_info["logs"] if "logs" in tx_info else []

# Look for the last returned value in the log
if not logs:
Expand Down Expand Up @@ -543,6 +544,7 @@ def execute(
raw_value=raw_value,
return_value=return_value,
decode_error=decode_error,
tx_info=tx_info,
)
method_results.append(abi_result)

Expand Down Expand Up @@ -688,17 +690,19 @@ def __init__(
tx_id: int,
raw_value: bytes,
return_value: Any,
decode_error: error,
decode_error: Optional[Exception],
tx_info: dict,
) -> None:
self.tx_id = tx_id
self.raw_value = raw_value
self.return_value = return_value
self.decode_error = decode_error
self.tx_info = tx_info


class AtomicTransactionResponse:
def __init__(
self, confirmed_round: int, tx_ids: List[str], results: ABIResult
self, confirmed_round: int, tx_ids: List[str], results: List[ABIResult]
) -> None:
self.confirmed_round = confirmed_round
self.tx_ids = tx_ids
Expand Down
2 changes: 1 addition & 1 deletion algosdk/data/langspec.json

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions algosdk/future/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@


class Template:
"""
NOTE: This class is deprecated
"""

def get_address(self):
"""
Return the address of the contract.
Expand All @@ -19,6 +23,8 @@ def get_program(self):

class Split(Template):
"""
NOTE: This class is deprecated.
Split allows locking algos in an account which allows transfering to two
predefined addresses in a specified ratio such that for the given ratn and
ratd parameters we have:
Expand Down Expand Up @@ -156,6 +162,8 @@ def get_split_funds_transaction(contract, amount: int, sp):

class HTLC(Template):
"""
NOTE: This class is deprecated.
Hash Time Locked Contract allows a user to recieve the Algo prior to a
deadline (in terms of a round) by proving knowledge of a special value
or to forfeit the ability to claim, returning it to the payer.
Expand Down Expand Up @@ -291,6 +299,8 @@ def get_transaction(contract, preimage, sp):

class DynamicFee(Template):
"""
NOTE: This class is deprecated.
DynamicFee contract allows you to create a transaction without
specifying the fee. The fee will be determined at the moment of
transfer.
Expand Down Expand Up @@ -416,6 +426,8 @@ def sign_dynamic_fee(self, private_key):

class PeriodicPayment(Template):
"""
NOTE: This class is deprecated.
PeriodicPayment contract enables creating an account which allows the
withdrawal of a fixed amount of assets every fixed number of rounds to a
specific Algrorand Address. In addition, the contract allows to add
Expand Down Expand Up @@ -528,6 +540,8 @@ def get_withdrawal_transaction(contract, sp):

class LimitOrder(Template):
"""
NOTE: This class is deprecated.
Limit Order allows to trade Algos for other assets given a specific ratio;
for N Algos, swap for Rate * N Assets.
...
Expand Down
Loading

0 comments on commit 240759e

Please sign in to comment.