Skip to content

Conversation

@liminalAngel
Copy link

provided highload wallet 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):
Copy link
Contributor

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:
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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):
Copy link
Contributor

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):
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants