-
Notifications
You must be signed in to change notification settings - Fork 48
highload wallet v3 implementation #32
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
base: master
Are you sure you want to change the base?
Conversation
provided highload v3 implementation
|
|
||
| return await self.send_external(body=transfer_msg) | ||
|
|
||
| async def transfer(self, destination: typing.Union[Address, str], amount: int, sendmode: int, created_at: int, timeout: int, body: Cell = Cell.empty(), state_init: StateInit = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
body: Cell = Cell.empty()
Do not create objects inside function signature except the cases you exactly understand what are you doing.
In [1]: from pytoniq_core import Cell
...:
...:
...: def f(b: Cell = Cell.empty()):
...: b.bits.append(1)
...: print(b.bits)
...:
...: f()
...: f()
...:
bitarray('1')
bitarray('11')| return mnemo, await cls.from_mnemonic(provider=provider, mnemonics=mnemo, wc=wc, wallet_id=wallet_id, timeout=timeout) | ||
|
|
||
| @staticmethod | ||
| def raw_create_transfer_msg(private_key: bytes, wallet_id: int, sendmode: int, created_at: int, timeout: int, message_to_send: WalletMessage, query_id: HighloadQueryId = 0) -> Cell: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query_id: HighloadQueryId = 0
looks like the default value is invalid
| """ | ||
| :return: is query processed from wallet's get method | ||
| """ | ||
| return (await super().run_get_method(method='processed?', stack=[query_id]))[0] No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats wrong with empty lines at the end of files ?
|
|
||
| async def raw_transfer(self, sendmode: int, created_at: int, timeout: int, msg: WalletMessage, query_id: HighloadQueryId = 0): | ||
| """ | ||
| :param sendmode: sendmode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be send_mode instead ?
| result_msg = self.create_wallet_internal_message(destination=destination, value=amount, body=body, state_init=state_init) | ||
| return await self.raw_transfer(sendmode=sendmode, created_at=created_at, timeout=timeout, msg=result_msg) | ||
|
|
||
| async def send_init_external(self, sendmode: int, created_at: int, timeout: int, message_to_send: WalletMessage): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, this is good place to set default values.
For example, I don't think many users will really understand meaning of timeout var and how it works. Let's advice some value.
| .store_cell(signing_message) \ | ||
| .end_cell() | ||
|
|
||
| async def raw_transfer(self, sendmode: int, created_at: int, timeout: int, msg: WalletMessage, query_id: HighloadQueryId = 0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to be able to send only one message per transaction?
provided highload wallet v3 implementation