highload wallet v3 implementation - #32
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.
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.
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.
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.
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.
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.
Do we really want to be able to send only one message per transaction?
provided highload wallet v3 implementation