-
Notifications
You must be signed in to change notification settings - Fork 15
NEM node rewards program support #677
Description
What is the current behavior?
There is no NEM node rewards program support in the NEM wallet.
What is the expected behavior?
Add NEM node rewards service in NEM wallet.
Add a new module in Services for NEM Node Rewards Program:
- opt-in module (and related code) is not needed anymore - we can remove it
- instead of an opt-in service we will add a node rewards program service
Select account component
On top of the screen there will be a selected "Account" component:
- In case when current account is not a cosigner of any multisig accounts we should present not editable address (disabled input) and balance. Account should be considered as chosen and tabs should be presented.
- In case when current account is a cosigner of any multisig accounts we should present a selector. Selector should contains current account with label "" + all multisig accounts (for which current account is cosigner) with label " - Multisig". When the user will choose an account, the balance field is filled and tabs are presented.
Status tab
On this screen we should present registration data (if already registered):
- node name
- status (possible values Active - green, Inactive - red)
- endpoint
- public key
- remote public key
- total rewards
This data will be fetched using API /node/<main_public_key>
If response code will be 404 we should present no data placeholder "-" and "INACTIVE" status.
Payout History tab
Data fetched using /node/<node_id>/payouts
(node_id is database id which is in response for /node/<main_public_key>
)
Presented data:
- from round -
fromRoundId
from api - to round -
toRoundId
from api - amount - amount is returned in microXEM but should be presented as relative (divided by 1,000,000)
- transaction hash - hash should be link to explorer. if isPaid = false hash will be empty. In such situation we should present "-"
- date - timestamp. Time should be converted using local user timezone
List should be paginated.
Enroll to Program tab
Form fields:
- enroll address - address which user have from social media
- ip/domain - IP or domain for node
- fee - calculated fee. On screenshot fee for transaction + fee for multisig. In case of non-multisig there will be only one fee.
- password - user password
Wallet on "Enroll" action should send transfer transaction:
- to address = enroll address
- with message
enroll <ip_or_domain> <hash>
where hash should be fetch from api using /codeword/<main_public_key_str>
Validation:
- wallet should block enroll if enroll address is not valid (validation based on api -
/enrollment/check/address/<address_str>
endpoint) - wallet should block enroll if current address already enrolled to this period. To check that wallet should first query
/enrollment/successes/<main_public_key_str>
get latest result (if exists) andrecipientAddress
from it. And next checkrecipientAddress
against/enrollment/check/address/<address_str>
Re-enrollment:
If user is doing re-enrollment (node data are already returned by API) we should put automatically IP/domain based on endpoint returned by /node/<main_public_key>
endpoint