Closed OrmEmbaar closed 4 years ago
What do you mean by this? The daemon does not store any keys, and I don't think pegnetd will ever talk to a wallet.
Pegnetd handles pAsset transactions and conversions. You can currently make an API request to issue a transaction using the send-transaction
method, but you cannot do it to issue a conversion.
In order to convert programmatically without pegnetd, it is necessary to implement conversions yourself. That may be okay if you know the data structures and logic, but if you don't then it is an unnecessary effort to discover that and reimplement it, especially as you are likely to have to run pegnetd anyway to get balances.
I am a bit confused about why there is a transaction method but no conversion method? Also, what do you mean you don't think it will ever talk to a wallet? Surely it already talks to walletd?
You can currently make an API request to issue a transaction using the
send-transaction
method, but you cannot do it to issue a conversion.
I think this is an unfortunate naming collision. A pegnet Transaction can both transfer and convert assets using the same format. The API send-transaction accepts arbitrary data and just writes whatever it receives to the transaction chain.
The command line calls transfers transactions, which is (imo) wrong. The API method should be called "write-entry" instead.
The transaction object that both the transfers and conversions use (as json payload) is: https://github.com/pegnet/pegnetd/blob/c08572678d771ca83e627b1452547dc488263819/fat/fat2/transaction.go#L86-L91
As you can see, it has both a "Transfers" list and a "Conversion" field. If the conversion field is set, it's a conversion. If there are items in the "Transfers" then it's a transfer. If both are set, the transaction is rejected.
The API command "send-transaction" doesn't actually handle any of the logic. It just gets sent raw data (extid, content) and is hardcoded to write it as an entry to the transaction chain using the ecaddress specified in the config file.
I see. Thanks for clearing that up, @WhoSoup. This issue can be closed.
Feature request for an API method to convert pAssets.