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

#86dtu8zqj - Remove boa feature from Getting started documentation #1271

Merged
merged 3 commits into from
Jun 24, 2024
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
2 changes: 2 additions & 0 deletions boa3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
__version__ = '1.2.1'

__boa3_builtin_deprecate_version__ = '1.3.0'
13 changes: 6 additions & 7 deletions boa3/builtin/compile_time/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
'NeoMetadata',
]

from deprecation import deprecated

from boa3.builtin.type import Event
from boa3.internal.deprecation import deprecated
from boa3.sc.compiletime import NeoMetadata


@deprecated(details='This module is deprecated. Use boa3.sc.utils instead')
@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.utils` instead')
def CreateNewEvent(arguments: list[tuple[str, type]] = [], event_name: str = '') -> Event:
"""
Creates a new Event.
Expand All @@ -33,12 +32,12 @@ def CreateNewEvent(arguments: list[tuple[str, type]] = [], event_name: str = '')
:param event_name: custom name of the event. It's filled with the variable name if not specified
:type event_name: str
:return: the new event
:rtype: Event
:rtype: boa3.builtin.type.Event
"""
pass


@deprecated(details='This module is deprecated. Use boa3.sc.compiletime instead')
@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.compiletime` instead')
def public(name: str = None, safe: bool = False, *args, **kwargs):
"""
This decorator identifies which methods should be included in the abi file. Adding this decorator to a function
Expand Down Expand Up @@ -88,7 +87,7 @@ def decorator_wrapper(*args, **kwargs):
return decorator_wrapper


@deprecated(details='This module is deprecated. Use boa3.sc.compiletime instead')
@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.compiletime` instead')
def contract(script_hash: str | bytes):
"""
This decorator identifies a class that should be interpreted as an interface to an existing contract.
Expand Down Expand Up @@ -129,7 +128,7 @@ def decorator_wrapper(cls, *args, **kwargs):
return decorator_wrapper


@deprecated(details='This module is deprecated. Use boa3.sc.compiletime instead')
@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.compiletime` instead')
def display_name(name: str):
"""
This decorator identifies which methods from a contract interface should have a different identifier from the one
Expand Down
5 changes: 2 additions & 3 deletions boa3/builtin/contract/Nep17Contract.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from typing import Any

from deprecation import deprecated

from boa3.builtin.interop.contract import Contract
from boa3.builtin.type import UInt160
from boa3.internal.deprecation import deprecated


@deprecated(details='This module is deprecated. Use boa3.sc.types instead')
@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.types` instead')
class Nep17Contract(Contract):
def symbol(self) -> str:
pass
Expand Down
13 changes: 6 additions & 7 deletions boa3/builtin/contract/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@

from typing import Any

from deprecation import deprecated

from boa3.builtin.compile_time import CreateNewEvent
from boa3.builtin.contract.Nep17Contract import Nep17Contract
from boa3.builtin.type import ECPoint, UInt160, Event
from boa3.internal.deprecation import deprecated

Nep11TransferEvent: Event = CreateNewEvent(
[
Expand Down Expand Up @@ -80,7 +79,7 @@
"""


@deprecated(details='This module is deprecated. Use boa3.sc.utils instead')
@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.utils` instead')
def abort(msg: str | None = None):
"""
Aborts the execution of a smart contract. Using this will cancel the changes made on the blockchain by the
Expand All @@ -96,7 +95,7 @@ def abort(msg: str | None = None):
pass


@deprecated(details='This module is deprecated. Use boa3.sc.types instead')
@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.types` instead')
class NeoAccountState:
"""
Represents the account state of NEO token in the NEO system.
Expand All @@ -106,7 +105,7 @@ class NeoAccountState:
:ivar height: the height of the block where the balance changed last time
:vartype height: int
:ivar vote_to: the voting target of the account
:vartype vote_to: ECPoint
:vartype vote_to: boa3.builtin.type.ECPoint
"""

def __init__(self):
Expand All @@ -117,7 +116,7 @@ def __init__(self):
self.last_gas_per_vote: int = 0


@deprecated(details='This module is deprecated. Use boa3.sc.utils instead')
@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.utils` instead')
def to_script_hash(data_bytes: Any) -> bytes:
"""
Converts a data to a script hash.
Expand All @@ -136,7 +135,7 @@ def to_script_hash(data_bytes: Any) -> bytes:
pass


@deprecated(details='This module is deprecated. Use boa3.sc.utils instead')
@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.utils` instead')
def to_hex_str(data: bytes) -> str:
"""
Converts bytes into its string hex representation.
Expand Down
35 changes: 17 additions & 18 deletions boa3/builtin/interop/blockchain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
'current_index',
]

from deprecation import deprecated

from boa3.builtin.interop.blockchain.block import Block
from boa3.builtin.interop.blockchain.signer import Signer
from boa3.builtin.interop.blockchain.transaction import Transaction
from boa3.builtin.interop.blockchain.vmstate import VMState
from boa3.builtin.interop.contract import Contract
from boa3.builtin.type import UInt160, UInt256
from boa3.internal.deprecation import deprecated


@deprecated(details='This module is deprecated. Use ContractManagement from boa3.sc.contracts instead')
@deprecated(details='This module is deprecated. Use :class:`ContractManagement` from :mod:`boa3.sc.contracts` instead')
def get_contract(hash: UInt160) -> Contract | None:
"""
Gets a contract with a given hash. If the script hash is not associated with a smart contract, then it will return
Expand All @@ -51,16 +50,16 @@ def get_contract(hash: UInt160) -> Contract | None:
None

:param hash: a smart contract hash
:type hash: UInt160
:type hash: boa3.builtin.type.UInt160
:return: a contract
:rtype: Contract
:rtype: boa3.builtin.interop.contract.contract.Contract

:raise Exception: raised if hash length isn't 20 bytes.
"""
pass


@deprecated(details='This module is deprecated. Use LedgerContract from boa3.sc.contracts instead')
@deprecated(details='This module is deprecated. Use :class:`LedgerContract` from :mod:`boa3.sc.contracts` instead')
def get_block(index_or_hash: int | UInt256) -> Block | None:
"""
Gets the block with the given index or hash. Will return None if the index or hash is not associated with a Block.
Expand Down Expand Up @@ -100,14 +99,14 @@ def get_block(index_or_hash: int | UInt256) -> Block | None:
None

:param index_or_hash: index or hash identifier of the block
:type index_or_hash: int or UInt256
:type index_or_hash: int or boa3.builtin.type.UInt256
:return: the desired block, if exists. None otherwise
:rtype: Block or None
:rtype: boa3.builtin.interop.blockchain.block.Block or None
"""
pass


@deprecated(details='This module is deprecated. Use LedgerContract from boa3.sc.contracts instead')
@deprecated(details='This module is deprecated. Use :class:`LedgerContract` from :mod:`boa3.sc.contracts` instead')
def get_transaction(hash_: UInt256) -> Transaction | None:
"""
Gets a transaction with the given hash. Will return None if the hash is not associated with a Transaction.
Expand All @@ -128,13 +127,13 @@ def get_transaction(hash_: UInt256) -> Transaction | None:
None

:param hash_: hash identifier of the transaction
:type hash_: UInt256
:type hash_: boa3.builtin.type.UInt256
:return: the Transaction, if exists. None otherwise
"""
pass


@deprecated(details='This module is deprecated. Use LedgerContract from boa3.sc.contracts instead')
@deprecated(details='This module is deprecated. Use :class:`LedgerContract` from :mod:`boa3.sc.contracts` instead')
def get_transaction_from_block(block_hash_or_height: UInt256 | int, tx_index: int) -> Transaction | None:
"""
Gets a transaction from a block. Will return None if the block hash or height is not associated with a Transaction.
Expand Down Expand Up @@ -170,15 +169,15 @@ def get_transaction_from_block(block_hash_or_height: UInt256 | int, tx_index: in
None

:param block_hash_or_height: a block identifier
:type block_hash_or_height: UInt256 or int
:type block_hash_or_height: boa3.builtin.type.UInt256 or int
:param tx_index: the transaction identifier in the block
:type tx_index: int
:return: the Transaction, if exists. None otherwise
"""
pass


@deprecated(details='This module is deprecated. Use LedgerContract from boa3.sc.contracts instead')
@deprecated(details='This module is deprecated. Use :class:`LedgerContract` from :mod:`boa3.sc.contracts` instead')
def get_transaction_height(hash_: UInt256) -> int:
"""
Gets the height of a transaction. Will return -1 if the hash is not associated with a Transaction.
Expand All @@ -193,13 +192,13 @@ def get_transaction_height(hash_: UInt256) -> int:
-1

:param hash_: hash identifier of the transaction
:type hash_: UInt256
:type hash_: boa3.builtin.type.UInt256
:return: height of the transaction
"""
pass


@deprecated(details='This module is deprecated. Use LedgerContract from boa3.sc.contracts instead')
@deprecated(details='This module is deprecated. Use :class:`LedgerContract` from :mod:`boa3.sc.contracts` instead')
def get_transaction_signers(hash_: UInt256) -> list[Signer]:
"""
Gets a list with the signers of a transaction.
Expand All @@ -216,13 +215,13 @@ def get_transaction_signers(hash_: UInt256) -> list[Signer]:
]

:param hash_: hash identifier of the transaction
:type hash_: UInt256
:type hash_: boa3.builtin.type.UInt256
:return: VM state of the transaction
"""
pass


@deprecated(details='This module is deprecated. Use LedgerContract from boa3.sc.contracts instead')
@deprecated(details='This module is deprecated. Use :class:`LedgerContract` from :mod:`boa3.sc.contracts` instead')
def get_transaction_vm_state(hash_: UInt256) -> VMState:
"""
Gets the VM state of a transaction.
Expand All @@ -231,7 +230,7 @@ def get_transaction_vm_state(hash_: UInt256) -> VMState:
VMState.HALT

:param hash_: hash identifier of the transaction
:type hash_: UInt256
:type hash_: boa3.builtin.type.UInt256
:return: VM state of the transaction
"""
pass
Expand Down
12 changes: 8 additions & 4 deletions boa3/builtin/interop/blockchain/block.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
__all__ = [
'Block'
]

from boa3.builtin.type import UInt160, UInt256


Expand All @@ -9,21 +13,21 @@ class Block:
about Blocks.

:ivar hash: a unique identifier based on the unsigned data portion of the object
:vartype hash: UInt256
:vartype hash: boa3.builtin.type.UInt256
:ivar version: the data structure version of the block
:vartype version: int
:ivar previous_hash: the hash of the previous block
:vartype previous_hash: UInt256
:vartype previous_hash: boa3.builtin.type.UInt256
:ivar merkle_root: the merkle root of the transactions
:vartype merkle_root: UInt256
:vartype merkle_root: boa3.builtin.type.UInt256
:ivar timestamp: UTC timestamp of the block in milliseconds
:vartype timestamp: int
:ivar nonce: a random number used once in the cryptography
:vartype nonce: int
:ivar index: the index of the block
:vartype index: int
:ivar next_consensus: the script hash of the consensus nodes that generates the next block
:vartype next_consensus: UInt160
:vartype next_consensus: boa3.builtin.type.UInt160
:ivar transaction_count: the number of transactions on this block
:vartype transaction_count: int
"""
Expand Down
15 changes: 7 additions & 8 deletions boa3/builtin/interop/blockchain/signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
"WitnessScope",
]

from deprecation import deprecated

from boa3.builtin.type import UInt160
from boa3.internal.deprecation import deprecated
from boa3.internal.neo3.network.payloads.verification import WitnessConditionType, WitnessRuleAction, WitnessScope


@deprecated(details='This module is deprecated. Use boa3.sc.types instead')
@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.types` instead')
class Signer:
"""
Represents a signer.
Expand All @@ -22,13 +21,13 @@ class Signer:
about Signers.

:ivar account:
:vartype account: UInt160
:vartype account: boa3.builtin.type.UInt160
:ivar scopes:
:vartype scopes: WitnessScope
:ivar allowed_contracts:
:vartype allowed_contracts: list[UInt160]
:vartype allowed_contracts: list[boa3.builtin.type.UInt160]
:ivar allowed_groups:
:vartype allowed_groups: list[UInt160]
:vartype allowed_groups: list[boa3.builtin.type.UInt160]
:ivar rules:
:vartype rules: list[WitnessRule]
"""
Expand All @@ -41,7 +40,7 @@ def __init__(self):
self.rules: list[WitnessRule] = []


@deprecated(details='This module is deprecated. Use boa3.sc.types instead')
@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.types` instead')
class WitnessRule:
"""
Represents a witness rule.
Expand All @@ -60,7 +59,7 @@ def __init__(self):
self.condition: WitnessCondition = WitnessCondition()


@deprecated(details='This module is deprecated. Use boa3.sc.types instead')
@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.types` instead')
class WitnessCondition:
"""
Represents a witness condition.
Expand Down
4 changes: 2 additions & 2 deletions boa3/builtin/interop/blockchain/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class Transaction:
Transactions.

:ivar hash: a unique identifier based on the unsigned data portion of the object
:vartype hash: UInt256
:vartype hash: boa3.builtin.type.UInt256
:ivar version: the data structure version of the transaction
:vartype version: int
:ivar nonce: a random number used once in the cryptography
:vartype nonce: int
:ivar sender: the sender is the first signer of the transaction, they will pay the fees of the transaction
:vartype sender: UInt160
:vartype sender: boa3.builtin.type.UInt160
:ivar system_fee: the fee paid for executing the `script`
:vartype system_fee: int
:ivar network_fee: the fee paid for the validation and inclusion of the transaction in a block by the consensus node
Expand Down
Loading
Loading