Skip to content

Commit

Permalink
[ECHOT-335] Update registration method and operation
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Vasilev authored Mar 23, 2020
1 parent a644ddc commit fcc4e77
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion echopy/echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self):
def solve_registration_task(self, block_id, rand_num, difficulty):
return solve_registration_task(block_id, rand_num, difficulty)

async def register_account(self, callback, name, active, echorand):
async def register_account(self, callback, name, active, echorand, evm_address=None):
if self.api.ws.connection is None:
raise AttributeError("Connection is needed: use 'connect' method for connecting to node")
task = self.api.registration.request_registration_task()
Expand All @@ -29,6 +29,7 @@ async def register_account(self, callback, name, active, echorand):
name,
active,
echorand,
evm_address,
nonce,
task["rand_num"]
)
Expand Down
5 changes: 3 additions & 2 deletions echopy/echoapi/ws_api/registration_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ async def request_registration_task(self):
[]
)

async def submit_registration_solution(self, callback, name, active, echorand_key, nonce, rand_num):
async def submit_registration_solution(self, callback, name, active, echorand_key,
evm_address, nonce, rand_num):
return await self.db.rpcexec(
'submit_registration_solution',
[callback, name, active, echorand_key, nonce, rand_num]
[callback, name, active, echorand_key, evm_address, nonce, rand_num]
)

async def get_registrar(self):
Expand Down
3 changes: 3 additions & 0 deletions echopy/echobase/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,15 @@ def detail(self, *args, **kwargs):
# Account Management
class AccountCreate(EchoObject):
def detail(self, *args, **kwargs):
evm_address = get_optional("evm_address", kwargs, Bytes)

result = OrderedDict(
[
("registrar", ObjectId(kwargs["registrar"], "account")),
("name", String(kwargs["name"])),
("active", Permission(kwargs["active"])),
("echorand_key", PublicKey(kwargs["echorand_key"])),
("evm_address", Optional(evm_address)),
("options", AccountOptions(kwargs["options"])),
("extensions", Set([])),
]
Expand Down

0 comments on commit fcc4e77

Please sign in to comment.