Skip to content

V5#56

Merged
yungwine merged 3 commits intomasterfrom
v5
Oct 29, 2025
Merged

V5#56
yungwine merged 3 commits intomasterfrom
v5

Conversation

@yungwine
Copy link
Copy Markdown
Owner

No description provided.

@yungwine yungwine requested a review from Copilot October 29, 2025 16:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for Wallet V5R1 to the pytoniq library, implementing the latest wallet version for the TON blockchain with enhanced features like signature control and extensions support.

  • Implements WalletV5R1 wallet class with full create/import functionality
  • Adds WalletV5WalletID helper class for wallet ID packing/unpacking
  • Updates pytoniq-core dependency to version 0.1.45

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
pytoniq/contract/wallets/wallet_v5.py New file implementing WalletV5R1 class and WalletV5WalletID helper
pytoniq/contract/wallets/wallet.py Moves message count assertion from raw_transfer to raw_create_transfer_msg
pytoniq/contract/wallets/init.py Exports new WalletV5R1 and WalletV5WalletID classes
tests/test_wallet.py Adds comprehensive tests for WalletV5WalletID packing/unpacking and wallet creation
setup.py Updates pytoniq-core dependency to >=0.1.45
examples/wallets/wallet_v5.py Provides usage example for WalletV5R1
Comments suppressed due to low confidence (1)

pytoniq/contract/wallets/wallet.py:52

    async def raw_transfer(self, *args, **kwargs): ...

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

subwallet_number: int = 0, is_signature_allowed: bool = True):
public_key = private_key_to_public_key(private_key)
return await cls.from_data(provider=provider, public_key=public_key, network_global_id=network_global_id, wc=wc, wallet_id=wallet_id,
private_key=private_key, is_signature_allowed=is_signature_allowed)
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing subwallet_number parameter in the call to from_data. The parameter is defined in from_private_key (line 107) but not passed through to from_data, which could lead to unexpected behavior when users specify a custom subwallet_number.

Suggested change
private_key=private_key, is_signature_allowed=is_signature_allowed)
private_key=private_key, subwallet_number=subwallet_number, is_signature_allowed=is_signature_allowed)

Copilot uses AI. Check for mistakes.
network_global_id: typing.Optional[int] = None,
subwallet_number: int = 0, is_signature_allowed: bool = True):
mnemo = mnemonic_new(24)
return mnemo, await cls.from_mnemonic(provider, mnemonics=mnemo, wc=wc, wallet_id=wallet_id, network_global_id=network_global_id, is_signature_allowed=is_signature_allowed)
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing subwallet_number parameter in the call to from_mnemonic. The parameter is defined in create (line 128) but not passed through, which could lead to unexpected behavior when users specify a custom subwallet_number.

Suggested change
return mnemo, await cls.from_mnemonic(provider, mnemonics=mnemo, wc=wc, wallet_id=wallet_id, network_global_id=network_global_id, is_signature_allowed=is_signature_allowed)
return mnemo, await cls.from_mnemonic(provider, mnemonics=mnemo, wc=wc, wallet_id=wallet_id, network_global_id=network_global_id, subwallet_number=subwallet_number, is_signature_allowed=is_signature_allowed)

Copilot uses AI. Check for mistakes.
"""
:return: unpacked subwallet_id from wallet's get method
"""
wallet_id = (await super().run_get_method("get_subwallet_id"))[0]
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space between '=' and '(' operators.

Suggested change
wallet_id = (await super().run_get_method("get_subwallet_id"))[0]
wallet_id = (await super().run_get_method("get_subwallet_id"))[0]

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +47
network_global_id = -239, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483409
network_global_id = -239, workchain = -1, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 8388369
network_global_id = -3, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483645
network_global_id = -3, workchain = -1, version = 0', subwallet_number = 0 (client context)
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect quote character in docstring. Should use double quote or remove the single quote after '0'.

Suggested change
network_global_id = -239, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483409
network_global_id = -239, workchain = -1, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 8388369
network_global_id = -3, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483645
network_global_id = -3, workchain = -1, version = 0', subwallet_number = 0 (client context)
network_global_id = -239, workchain = 0, version = 0, subwallet_number = 0 (client context)
gives wallet_id = 2147483409
network_global_id = -239, workchain = -1, version = 0, subwallet_number = 0 (client context)
gives wallet_id = 8388369
network_global_id = -3, workchain = 0, version = 0, subwallet_number = 0 (client context)
gives wallet_id = 2147483645
network_global_id = -3, workchain = -1, version = 0, subwallet_number = 0 (client context)

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +47
network_global_id = -239, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483409
network_global_id = -239, workchain = -1, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 8388369
network_global_id = -3, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483645
network_global_id = -3, workchain = -1, version = 0', subwallet_number = 0 (client context)
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect quote character in docstring. Should use double quote or remove the single quote after '0'.

Suggested change
network_global_id = -239, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483409
network_global_id = -239, workchain = -1, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 8388369
network_global_id = -3, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483645
network_global_id = -3, workchain = -1, version = 0', subwallet_number = 0 (client context)
network_global_id = -239, workchain = 0, version = 0, subwallet_number = 0 (client context)
gives wallet_id = 2147483409
network_global_id = -239, workchain = -1, version = 0, subwallet_number = 0 (client context)
gives wallet_id = 8388369
network_global_id = -3, workchain = 0, version = 0, subwallet_number = 0 (client context)
gives wallet_id = 2147483645
network_global_id = -3, workchain = -1, version = 0, subwallet_number = 0 (client context)

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +47
network_global_id = -239, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483409
network_global_id = -239, workchain = -1, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 8388369
network_global_id = -3, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483645
network_global_id = -3, workchain = -1, version = 0', subwallet_number = 0 (client context)
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect quote character in docstring. Should use double quote or remove the single quote after '0'.

Suggested change
network_global_id = -239, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483409
network_global_id = -239, workchain = -1, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 8388369
network_global_id = -3, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483645
network_global_id = -3, workchain = -1, version = 0', subwallet_number = 0 (client context)
network_global_id = -239, workchain = 0, version = 0, subwallet_number = 0 (client context)
gives wallet_id = 2147483409
network_global_id = -239, workchain = -1, version = 0, subwallet_number = 0 (client context)
gives wallet_id = 8388369
network_global_id = -3, workchain = 0, version = 0, subwallet_number = 0 (client context)
gives wallet_id = 2147483645
network_global_id = -3, workchain = -1, version = 0, subwallet_number = 0 (client context)

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +47
network_global_id = -239, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483409
network_global_id = -239, workchain = -1, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 8388369
network_global_id = -3, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483645
network_global_id = -3, workchain = -1, version = 0', subwallet_number = 0 (client context)
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect quote character in docstring. Should use double quote or remove the single quote after '0'.

Suggested change
network_global_id = -239, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483409
network_global_id = -239, workchain = -1, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 8388369
network_global_id = -3, workchain = 0, version = 0', subwallet_number = 0 (client context)
gives wallet_id = 2147483645
network_global_id = -3, workchain = -1, version = 0', subwallet_number = 0 (client context)
network_global_id = -239, workchain = 0, version = 0, subwallet_number = 0 (client context)
gives wallet_id = 2147483409
network_global_id = -239, workchain = -1, version = 0, subwallet_number = 0 (client context)
gives wallet_id = 8388369
network_global_id = -3, workchain = 0, version = 0, subwallet_number = 0 (client context)
gives wallet_id = 2147483645
network_global_id = -3, workchain = -1, version = 0, subwallet_number = 0 (client context)

Copilot uses AI. Check for mistakes.
@pytest.mark.asyncio
async def test_wallet_v5_creation(client):
with pytest.raises(WalletError): # wallet_id or network_global_id is required
m, w = await WalletV5R1.create(client, wc=-1)
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment to 'm' is unnecessary as it is redefined before this value is used.

Suggested change
m, w = await WalletV5R1.create(client, wc=-1)
await WalletV5R1.create(client, wc=-1)

Copilot uses AI. Check for mistakes.
@pytest.mark.asyncio
async def test_wallet_v5_creation(client):
with pytest.raises(WalletError): # wallet_id or network_global_id is required
m, w = await WalletV5R1.create(client, wc=-1)
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment to 'w' is unnecessary as it is redefined before this value is used.

Suggested change
m, w = await WalletV5R1.create(client, wc=-1)
await WalletV5R1.create(client, wc=-1)

Copilot uses AI. Check for mistakes.
import time
import typing

from .wallet import Wallet, WalletError, BaseWallet
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'Wallet' is not used.

Suggested change
from .wallet import Wallet, WalletError, BaseWallet
from .wallet import WalletError, BaseWallet

Copilot uses AI. Check for mistakes.
@yungwine yungwine merged commit c15747d into master Oct 29, 2025
0 of 3 checks passed
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