-
Notifications
You must be signed in to change notification settings - Fork 12
feat: send payment transaction with algokit core #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
32432d9
chore: installing local python ffi package
CiottiGiorgio f15e32e
feat: using AlgoKit Core to build a payment transaction
CiottiGiorgio 2700fbc
chore: addressed review comment on bridge core module visibility
CiottiGiorgio 33a53ee
Merge branch 'main' into feat/algokit-core-payment
CiottiGiorgio 064c069
chore: adding locally built algod client
CiottiGiorgio 13e06d4
chore: rename payment_through_core -> build_payment_with_core
CiottiGiorgio 5be8767
fix: keep the user min fee if set
CiottiGiorgio ae54d01
chore: update algod client
CiottiGiorgio 0362cf9
chore: use algokit core from GH releases
CiottiGiorgio 7dc168a
chore: use algod generated client from local filesystem because of a …
CiottiGiorgio 40c674b
feat: using AlgodApi OpenAPI generated client to send transactions to…
CiottiGiorgio efac078
chore: adding the released version of python algokit algod client
CiottiGiorgio 2ec3993
fix: introducing tagged releases for the integration with algokit-core
CiottiGiorgio 89b9d89
chore: using the locally built version for now while we wait for CICD…
CiottiGiorgio b7b0f00
chore: using algolkit algod client from a package repo
CiottiGiorgio 9c47442
wip: optional deps group as feature flag & adherence to new client's …
CiottiGiorgio 67940f4
fix: correctly re-throw the exception
CiottiGiorgio b054765
chore: format
CiottiGiorgio 73b97b0
chore: excluding experimental group form CI/CD
CiottiGiorgio 481f712
chore: poetry update setuptools
CiottiGiorgio 24c2a25
chore: ignore untyped stuff that replicates algosdk
CiottiGiorgio cb19b84
chore: removing redundant exception check
CiottiGiorgio eb82ba9
chore: poetry run format
CiottiGiorgio d64633d
chore: fix mypy and linting issues
CiottiGiorgio 1f57a16
chore: remove redundant docstring
CiottiGiorgio add1bde
chore: allow the test to accept more than one log in case we are usin…
CiottiGiorgio c87d458
chore: updated to lates algokit core deps
lempira 231395a
feat: calculated fee using assign_fee from core
lempira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,46 @@ | ||
import base64 | ||
|
||
import algokit_transact | ||
import algosdk.transaction | ||
|
||
|
||
def payment_through_core( | ||
sender, | ||
sp, | ||
receiver, | ||
amt, | ||
close_remainder_to=None, | ||
note=None, | ||
lease=None, | ||
rekey_to=None, | ||
) -> algosdk.transaction.PaymentTxn: | ||
txn = algokit_transact.Transaction( | ||
transaction_type=algokit_transact.TransactionType.PAYMENT, | ||
sender=algokit_transact.address_from_string(sender), | ||
# The correct fee will be calculated later based on suggested params and estimated size of the transaction. | ||
fee=sp.fee, | ||
first_valid=sp.first, | ||
last_valid=sp.last, | ||
genesis_hash=base64.b64decode(sp.gh), | ||
genesis_id=sp.gen, | ||
note=note, | ||
lease=lease, | ||
rekey_to=algokit_transact.address_from_string(rekey_to) if rekey_to else None, | ||
payment=algokit_transact.PaymentTransactionFields( | ||
receiver=algokit_transact.address_from_string(receiver), | ||
amount=amt, | ||
close_remainder_to=algokit_transact.address_from_string(close_remainder_to) if close_remainder_to else None, | ||
), | ||
) | ||
|
||
size = algokit_transact.estimate_transaction_size(txn) | ||
final_fee: int | ||
if sp.flat_fee: | ||
final_fee = sp.fee | ||
else: | ||
final_fee = max(algosdk.constants.MIN_TXN_FEE, sp.flat_fee * size) | ||
txn.fee = final_fee | ||
|
||
return algosdk.encoding.msgpack_decode( | ||
base64.b64encode(algokit_transact.encode_transaction_raw(txn)).decode("utf-8") | ||
) |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.