Skip to content
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

[ECHOT-335] Update registration method and operation #15

Merged
merged 1 commit into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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