Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: algorand/py-algorand-sdk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.13.1
Choose a base ref
...
head repository: algorand/py-algorand-sdk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: develop
Choose a head ref
Loading
Showing with 15,286 additions and 15,332 deletions.
  1. +8 −6 .circleci/config.yml
  2. +8 −0 .git-blame-ignore-revs
  3. +20 −0 .github/release.yml
  4. +201 −0 .github/workflows/create-release-pr.yml
  5. +26 −0 .github/workflows/pr-type-category.yml
  6. +1 −1 .gitignore
  7. +2 −2 .readthedocs.yaml
  8. +16 −0 .test-env
  9. +314 −0 CHANGELOG.md
  10. +128 −0 CODE_OF_CONDUCT.md
  11. +1 −2 Dockerfile
  12. +2 −1 MANIFEST.in
  13. +49 −7 Makefile
  14. +31 −6 README.md
  15. +46 −18 algosdk/__init__.py
  16. +68 −0 algosdk/__init__.pyi
  17. +35 −11 algosdk/abi/__init__.py
  18. +5 −6 algosdk/abi/address_type.py
  19. +1 −3 algosdk/abi/array_dynamic_type.py
  20. +3 −5 algosdk/abi/array_static_type.py
  21. +5 −8 algosdk/abi/base_type.py
  22. +2 −4 algosdk/abi/bool_type.py
  23. +3 −5 algosdk/abi/byte_type.py
  24. +31 −11 algosdk/abi/contract.py
  25. +21 −7 algosdk/abi/interface.py
  26. +45 −11 algosdk/abi/method.py
  27. +1 −1 algosdk/abi/string_type.py
  28. +1 −1 algosdk/abi/transaction.py
  29. +11 −10 algosdk/abi/tuple_type.py
  30. +1 −3 algosdk/abi/ufixed_type.py
  31. +1 −3 algosdk/abi/uint_type.py
  32. +0 −375 algosdk/algod.py
  33. +516 −274 algosdk/atomic_transaction_composer.py
  34. +100 −0 algosdk/box_reference.py
  35. +14 −2 algosdk/constants.py
  36. +0 −1 algosdk/data/langspec.json
  37. +24 −21 algosdk/dryrun_results.py
  38. +22 −43 algosdk/encoding.py
  39. +31 −26 algosdk/error.py
  40. +0 −4 algosdk/future/__init__.py
  41. +0 −733 algosdk/future/template.py
  42. +0 −3,226 algosdk/future/transaction.py
  43. +76 −52 algosdk/kmd.py
  44. +1 −204 algosdk/logic.py
  45. +0 −22 algosdk/mnemonic.py
  46. 0 test/__init__.py → algosdk/py.typed
  47. +85 −0 algosdk/source_map.py
  48. +0 −743 algosdk/template.py
  49. +9 −11 algosdk/testing/dryrun.py
  50. +2,127 −328 algosdk/transaction.py
  51. +2 −0 algosdk/v2client/__init__.py
  52. +483 −78 algosdk/v2client/algod.py
  53. +176 −59 algosdk/v2client/indexer.py
  54. +24 −0 algosdk/v2client/models/__init__.py
  55. +5 −3 algosdk/v2client/models/account.py
  56. +5 −3 algosdk/v2client/models/account_participation.py
  57. +5 −3 algosdk/v2client/models/application.py
  58. +5 −3 algosdk/v2client/models/application_local_state.py
  59. +5 −3 algosdk/v2client/models/application_params.py
  60. +5 −3 algosdk/v2client/models/application_state_schema.py
  61. +5 −3 algosdk/v2client/models/asset.py
  62. +5 −3 algosdk/v2client/models/asset_holding.py
  63. +5 −3 algosdk/v2client/models/asset_params.py
  64. +5 −3 algosdk/v2client/models/dryrun_request.py
  65. +5 −3 algosdk/v2client/models/dryrun_source.py
  66. +97 −0 algosdk/v2client/models/simulate_request.py
  67. +5 −3 algosdk/v2client/models/teal_key_value.py
  68. +5 −3 algosdk/v2client/models/teal_value.py
  69. +0 −7 docs/algosdk/algod.rst
  70. +7 −0 docs/algosdk/box_reference.rst
  71. +7 −0 docs/algosdk/dryrun_results.rst
  72. +0 −8 docs/algosdk/future/index.rst
  73. +0 −7 docs/algosdk/future/template.rst
  74. +0 −7 docs/algosdk/future/transaction.rst
  75. +3 −3 docs/algosdk/index.rst
  76. +7 −0 docs/algosdk/source_map.rst
  77. +0 −7 docs/algosdk/template.rst
  78. +2 −2 docs/conf.py
  79. +1 −1 docs/requirements.txt
  80. +11 −0 examples/README.md
  81. +100 −0 examples/account.py
  82. +0 −18 examples/account_backup_example.py
  83. +100 −0 examples/application/approval.teal
  84. +107 −0 examples/application/approval_refactored.teal
  85. +3 −0 examples/application/clear.teal
  86. +142 −0 examples/apps.py
  87. +226 −0 examples/asa.py
  88. +0 −24 examples/asset_accept_example.py
  89. +0 −51 examples/asset_create_example.py
  90. +0 −25 examples/asset_destroy_example.py
  91. +0 −30 examples/asset_freeze_example.py
  92. +0 −28 examples/asset_revoke_example.py
  93. +0 −27 examples/asset_send_example.py
  94. +0 −39 examples/asset_update_example.py
  95. +87 −0 examples/atc.py
  96. +55 −0 examples/atomic_transfers.py
  97. +181 −0 examples/calculator/approval.teal
  98. +3 −0 examples/calculator/clear.teal
  99. +74 −0 examples/calculator/contract.json
  100. +89 −0 examples/codec.py
  101. +0 −46 examples/custom_header_example.py
  102. +63 −0 examples/debug.py
  103. +0 −125 examples/example.py
  104. +92 −0 examples/indexer.py
  105. +20 −0 examples/inspect-error.py
  106. +90 −0 examples/kmd.py
  107. +0 −28 examples/log_sig_example.py
  108. +140 −0 examples/lsig.py
  109. +5 −0 examples/lsig/sample_arg.teal
  110. +3 −0 examples/lsig/simple.teal
  111. +0 −34 examples/multisig_example.py
  112. +0 −57 examples/notefield_example.py
  113. +87 −0 examples/overview.py
  114. +44 −0 examples/participation.py
  115. +0 −21 examples/rekey_example.py
  116. +23 −0 examples/smoke_test.sh
  117. +0 −43 examples/tokens.py
  118. +0 −33 examples/transaction_group_example.py
  119. +188 −0 examples/utils.py
  120. +0 −19 examples/wallet_backup_example.py
  121. +0 −23 examples/wallet_example.py
  122. +0 −17 examples/wallet_recover_example.py
  123. +5 −0 mypy.ini
  124. +4 −1 requirements.txt
  125. +0 −30 run_integration.sh
  126. 0 {test/steps → scripts}/__init__.py
  127. +43 −0 scripts/bump_version.py
  128. +117 −0 scripts/generate_init.py
  129. +10 −4 setup.py
  130. +123 −0 test-harness.sh
  131. +0 −3,202 test/steps/v2_steps.py
  132. +0 −531 test_integration.py
  133. +0 −4,171 test_unit.py
  134. 0 tests/__init__.py
  135. +18 −8 {test → tests}/environment.py
  136. +21 −0 tests/integration.tags
  137. 0 tests/steps/__init__.py
  138. +285 −0 tests/steps/account_v2_steps.py
  139. +1,298 −0 tests/steps/application_v2_steps.py
  140. +2,038 −0 tests/steps/other_v2_steps.py
  141. +171 −282 {test → tests}/steps/steps.py
  142. +44 −0 tests/unit.tags
  143. 0 tests/unit_tests/__init__.py
  144. +726 −0 tests/unit_tests/test_abi.py
  145. +518 −0 tests/unit_tests/test_dryrun.py
  146. +824 −0 tests/unit_tests/test_logicsig.py
  147. +616 −0 tests/unit_tests/test_other.py
  148. +1,526 −0 tests/unit_tests/test_transaction.py
14 changes: 8 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
version: 2.1
orbs:
slack: circleci/slack@4.12.5

workflows:
version: 2
@@ -7,11 +9,11 @@ workflows:
- unit-test:
matrix:
parameters:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.10", "3.11", "3.12"]
- integration-test:
matrix:
parameters:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.10", "3.11", "3.12"]
- docset

jobs:
@@ -24,21 +26,21 @@ jobs:
steps:
- checkout
- run: pip install -r requirements.txt
- run: black --check .
- run: python3 test_unit.py
- run: make lint
- run: make pytest-unit
integration-test:
parameters:
python-version:
type: string
machine:
image: "ubuntu-2004:202104-01"
image: "ubuntu-2004:2023.04.2"
steps:
- checkout
- run: PYTHON_VERSION=<< parameters.python-version >> make docker-test
docset:
docker:
# NOTE: We might eventually need Docker authentication here.
- image: cimg/python:3.8
- image: cimg/python:3.10
steps:
- checkout
- run:
8 changes: 8 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# .git-blame-ignore-revs
# Exclude formatting commits made by black
# more black formatting Aug 17, 2021
a9facdf30ca467b6e16d13ce88d8889bba7f2e1c
# formatting Aug 16, 2021
ea81ba259216b8be7fb86ef5d3e9c151a94edf87
# apply black Aug 11, 2021
81fe44f0dd9785b1665bbbea047aed591912534b
20 changes: 20 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
changelog:
exclude:
labels:
- Skip-Release-Notes
categories:
- title: Bugfixes
labels:
- Bug-Fix
- title: New Features
labels:
- New Feature
- title: Enhancements
labels:
- Enhancement
- title: Not Yet Enabled
labels:
- Not-Yet-Enabled
- title: Other
labels:
- "*"
201 changes: 201 additions & 0 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
name: Create Release PR

on:
workflow_dispatch:
inputs:
release_version:
description: 'The release_version used for the release branch name, e.g. release/vx.x.x'
default: 'vx.x.x'
required: true
type: string
pre_release_version:
description: "(Optional) Pre-Release version, e.g. 'b1'. Used mainly to support consensus release on betanet."
required: false
type: string

env:
RELEASE_VERSION: ${{ inputs.release_version }}
PRE_RELEASE_VERSION: ${{ inputs.pre_release_version }}
RELEASE_BRANCH: release/${{ inputs.release_version }}

jobs:
create-release-pr:
runs-on: ubuntu-latest

steps:
- name: Set Release Version and Branch to Check Out
id: set-release
run: |
if [[ $RELEASE_VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
if [[ $PRE_RELEASE_VERSION =~ ^[a-z.0-9]+$ ]]; then
echo "release-tag: $RELEASE_VERSION$PRE_RELEASE_VERSION"
echo "release-tag=$RELEASE_VERSION$PRE_RELEASE_VERSION" >> $GITHUB_OUTPUT
elif [[ -n $PRE_RELEASE_VERSION ]]; then
echo "Input pre_release_version is not empty, but does not match the regex pattern ^[a-z.0-9]+$"
exit 1
else
echo "release-tag: $RELEASE_VERSION"
echo "release-tag=$RELEASE_VERSION" >> $GITHUB_OUTPUT
fi
else
echo "Version input doesn't match the regex pattern ^v[0-9]+\.[0-9]+\.[0-9]+$"
exit 1
fi
- name: Checkout
uses: actions/checkout@v3.5.3
with:
fetch-depth: 0

- name: Create Release Branch if it does not exist
run: |
if ! git show-ref --verify --quiet "refs/remotes/origin/$RELEASE_BRANCH"; then
git checkout -b $RELEASE_BRANCH
git push --set-upstream origin $RELEASE_BRANCH
elif [[ $(git rev-parse --abbrev-ref HEAD) != "$RELEASE_BRANCH" ]]; then
echo "Current Branch: $(git rev-parse --abbrev-ref HEAD)"
echo "Release branch exists, make sure you're using the workflow from the release branch or delete the existing release branch."
exit 1
else
echo "Release branch exists and used as workflow ref."
fi
- name: Get Latest Release
id: get-release
run: |
if [[ -n $PRE_RELEASE_VERSION ]]; then
echo "Get the latest release"
tag=$(curl -L \
--header "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/releases" | jq -r '.[0].tag_name')
echo "latest-tag=$tag" >> $GITHUB_OUTPUT
else
echo "Get the latest stable release"
tag=$(curl -L \
--header "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name')
echo "latest-tag=$tag" >> $GITHUB_OUTPUT
fi
- name: Build Changelog
id: build-changelog
env:
PREVIOUS_VERSION: ${{ steps.get-release.outputs.latest-tag }}
run: |
CHANGELOG=$(curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ github.token }}"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \
-d '{"tag_name":"${{ env.RELEASE_VERSION }}","target_commitish":"${{ env.RELEASE_BRANCH }}","previous_tag_name":"${{ env.PREVIOUS_VERSION }}","configuration_file_path":".github/release.yml"}' \
| jq -r '.body')
# The EOF steps are used to save multiline string in github:
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-multiline-string
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "changelog<<$EOF" >> $GITHUB_OUTPUT
echo -e "${CHANGELOG}" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Update Changelog
if: ${{ env.PRE_RELEASE_VERSION == '' }}
env:
CHANGELOG_CONTENT: ${{ steps.build-changelog.outputs.changelog }}
PREVIOUS_VERSION: ${{ steps.get-release.outputs.latest-tag }}
run: |
echo "$(tail -n +2 CHANGELOG.md)" > CHANGELOG.md
echo -e "# Changelog\n\n# ${RELEASE_VERSION}\n\n${CHANGELOG_CONTENT}" | cat - CHANGELOG.md > temp && mv temp CHANGELOG.md
- name: Update version in setup.py
env:
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }}
run: |
python3 scripts/bump_version.py ${RELEASE_TAG:1}
- name: Commit Changes
uses: EndBug/add-and-commit@v9.1.3
env:
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }}
with:
message: "bump up version to ${{ env.RELEASE_TAG }}"

- name: Create Pull Request to Master
env:
CHANGELOG_CONTENT: ${{ steps.build-changelog.outputs.changelog }}
PREVIOUS_VERSION: ${{ steps.get-release.outputs.latest-tag }}
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }}
run: |
# Note: There's an issue adding teams as reviewers, see https://github.com/cli/cli/issues/6395
PULL_REQUEST_URL=$(gh pr create --base "master" \
--title "FOR REVIEW ONLY: ${{ github.event.repository.name }} $RELEASE_TAG" \
--label "Skip-Release-Notes" \
--label "Team Hyper Flow" \
--body "${CHANGELOG_CONTENT}" | tail -n 1)
if [[ $PULL_REQUEST_URL =~ ^https://github.com/${{ github.repository }}/pull/[0-9]+$ ]]; then
PULL_REQUEST_NUM=$(echo $PULL_REQUEST_URL | sed 's:.*/::')
echo "pull-request-master=$PULL_REQUEST_URL" >> $GITHUB_ENV
echo "pull-request-master-num=$PULL_REQUEST_NUM" >> $GITHUB_ENV
echo "Pull request to Master created: $PULL_REQUEST_URL"
else
echo "There was an issue creating the pull request to master branch."
exit 1
fi
- name: Create Pull Request to Develop
if: ${{ env.PRE_RELEASE_VERSION == '' }}
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }}
run: |
# Note: There's an issue adding teams as reviewers, see https://github.com/cli/cli/issues/6395
PULL_REQUEST_URL=$(gh pr create --base "develop" \
--title "FOR REVIEW ONLY: Merge back ${{ github.event.repository.name }} $RELEASE_TAG to develop" \
--label "Skip-Release-Notes" \
--label "Team Hyper Flow" \
--body "Merge back version changes to develop." | tail -n 1)
if [[ $PULL_REQUEST_URL =~ ^https://github.com/${{ github.repository }}/pull/[0-9]+$ ]]; then
echo "Pull request to Develop created: $PULL_REQUEST_URL"
DEVELOP_PR_MESSAGE="\nPull Request to develop: $PULL_REQUEST_URL"
echo "pull-request-develop-message=$DEVELOP_PR_MESSAGE" >> $GITHUB_ENV
else
echo "There was an issue creating the pull request to develop branch."
exit 1
fi
- name: Send Slack Message
id: slack
uses: slackapi/slack-github-action@v1.24.0
env:
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
SDK_DEPLOYMENT_URL: ${{ secrets.SDK_DEPLOYMENT_URL }}
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "${{ github.event.repository.name }} Release PR for ${{ env.RELEASE_TAG }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Approvals needed for*:\nPull Request to master: ${{ env.pull-request-master}}${{ env.pull-request-develop-message }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*After approvals*\nDeploy SDK using the <${{ env.SDK_DEPLOYMENT_URL }}|Deployment Pipeline> with the following parameters:\n*SDK*: ${{ github.event.repository.name }}\n*RELEASE_PR_NUM*: ${{ env.pull-request-master-num }}\n*RELEASE_VERSION*: ${{ env.RELEASE_VERSION }}\n*PRE_RELEASE_VERSION*: ${{ env.PRE_RELEASE_VERSION }}"
}
}
]
}
26 changes: 26 additions & 0 deletions .github/workflows/pr-type-category.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Check PR category and type
on:
pull_request:
branches:
- develop
types: [opened, synchronize, reopened, labeled, unlabeled, edited]
jobs:
check_label:
runs-on: ubuntu-latest
name: Check PR Category and Type
steps:
- name: Checking for correct number of required github pr labels
uses: mheap/github-action-required-labels@v2
with:
mode: exactly
count: 1
labels: "New Feature, Enhancement, Bug-Fix, Not-Yet-Enabled, Skip-Release-Notes"

- name: "Checking for PR Category in PR title. Should be like '<category>: <pr title>'."
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
if [[ ! "$PR_TITLE" =~ ^.{2,}\:.{2,} ]]; then
echo "## PR Category is missing from PR title. Please add it like '<category>: <pr title>'." >> GITHUB_STEP_SUMMARY
exit 1
fi
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ venv.bak/

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

# Build files
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
version: 2

build:
os: ubuntu-20.04
os: ubuntu-22.04
tools:
python: "3.8"
python: "3.10"

sphinx:
configuration: docs/conf.py
16 changes: 16 additions & 0 deletions .test-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Configs for testing repo download:
SDK_TESTING_URL="https://github.com/algorand/algorand-sdk-testing"
SDK_TESTING_BRANCH="master"
SDK_TESTING_HARNESS="test-harness"

INSTALL_ONLY=0

VERBOSE_HARNESS=1

# WARNING: If set to 1, new features will be LOST when downloading the test harness.
# REGARDLESS: modified features are ALWAYS overwritten.
REMOVE_LOCAL_FEATURES=0

# WARNING: Be careful when turning on the next variable.
# In that case you'll need to provide all variables expected by `algorand-sdk-testing`'s `.env`
OVERWRITE_TESTING_ENVIRONMENT=0
Loading