-
Notifications
You must be signed in to change notification settings - Fork 143
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
SDK does not recognize offline keyreg transaction #192
Comments
Hey @ejbaran, not sure if the team is taking PRs for this. I took a look at the codebase and found that you can actually call from algosdk.v2client import algod
from algosdk import transaction
algod_address = "https://algoexplorerapi.io"
algod_token = ""
# See https://github.com/algorand/py-algorand-sdk/issues/169 on User-Agent.
algod_client = algod.AlgodClient(algod_token, algod_address, headers={'User-Agent': 'Random'})
status = algod_client.status()
params = algod_client.suggested_params()
data = {
"sender": "EW64GC6F24M7NDSC5R3ES4YUVE3ZXXNMARJHDCCCLIHZU6TBEOC7XRSBG4",
"votekey": None,
"selkey": None,
"votefst": None,
"votelst": None,
"votekd": None,
"fee": 1000,
"flat_fee": True,
"first": 7000000,
"last": 7001000,
"gen": params.gen,
"gh": params.gh
}
txn = transaction.KeyregTxn(**data)
transaction.write_to_file([txn], "dump.txn")
txn2 = transaction.retrieve_from_file("dump.txn") This code has a |
That's about right. You can form the transaction using the base class for keyreg, but the read/write logic doesn't know how to process it (looks like the dictify/undictify functions require the partkey fields). I think the right solution here is to add constructors specifically for |
The problem lies with Using the same example above, the object that is dictified right before encoding in the write phase looks like this:
However, the object that's supposed to be undictified in the read phase looks like this (values with
Two questions:
If the team is happy to review a PR on this I'll be keen to try one. |
We'd be happy to take a PR for this. If it helps, here is the relevant code in the Javascript SDK that properly deals with the case when nonParticipation is true (i.e. offline key reg transaction): https://github.com/algorand/js-algorand-sdk/blob/e43e31231542b790b39e16faf09dbd2801b01c7f/src/transaction.ts#L461-L895 @jkschin I believe the answer to your questions are:
|
@jasonpaulos I assume the change should be made in
I looked at the implementation of
|
@jkschin Yes I believe the changes should happen only in the future folder. The And yes, the plan is to move the contents of the future folder into the main library in the next major release. |
There is no offline key registration type, so you have to instantiate it with the base Transaction class and set the type manually.
txn = transaction.Transaction(addr, sp, None, None, constants.keyreg_txn, None)
This is not ideal but fine, until you go to use
transaction.retrieve_from_file(<offline-txn-file>)
and then it fails because it tries to look for partkey info.The text was updated successfully, but these errors were encountered: