diff --git a/boa3/__init__.py b/boa3/__init__.py index 0854f9922..ded2f80ca 100644 --- a/boa3/__init__.py +++ b/boa3/__init__.py @@ -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' diff --git a/boa3/builtin/compile_time/__init__.py b/boa3/builtin/compile_time/__init__.py index 84174e9c5..df1c30c84 100644 --- a/boa3/builtin/compile_time/__init__.py +++ b/boa3/builtin/compile_time/__init__.py @@ -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. @@ -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 @@ -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. @@ -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 diff --git a/boa3/builtin/contract/Nep17Contract.py b/boa3/builtin/contract/Nep17Contract.py index 4cd25ce47..9b1658406 100644 --- a/boa3/builtin/contract/Nep17Contract.py +++ b/boa3/builtin/contract/Nep17Contract.py @@ -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 diff --git a/boa3/builtin/contract/__init__.py b/boa3/builtin/contract/__init__.py index 40d048024..aed94d3e9 100644 --- a/boa3/builtin/contract/__init__.py +++ b/boa3/builtin/contract/__init__.py @@ -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( [ @@ -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 @@ -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. @@ -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): @@ -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. @@ -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. diff --git a/boa3/builtin/interop/blockchain/__init__.py b/boa3/builtin/interop/blockchain/__init__.py index 16ed7dde7..08bb433ab 100644 --- a/boa3/builtin/interop/blockchain/__init__.py +++ b/boa3/builtin/interop/blockchain/__init__.py @@ -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 @@ -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. @@ -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. @@ -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. @@ -170,7 +169,7 @@ 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 @@ -178,7 +177,7 @@ def get_transaction_from_block(block_hash_or_height: UInt256 | int, tx_index: in 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. @@ -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. @@ -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. @@ -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 diff --git a/boa3/builtin/interop/blockchain/block.py b/boa3/builtin/interop/blockchain/block.py index 08fd6b64e..3f68595c1 100644 --- a/boa3/builtin/interop/blockchain/block.py +++ b/boa3/builtin/interop/blockchain/block.py @@ -1,3 +1,7 @@ +__all__ = [ + 'Block' +] + from boa3.builtin.type import UInt160, UInt256 @@ -9,13 +13,13 @@ 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 @@ -23,7 +27,7 @@ class Block: :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 """ diff --git a/boa3/builtin/interop/blockchain/signer.py b/boa3/builtin/interop/blockchain/signer.py index 57461400e..dd8f7ab65 100644 --- a/boa3/builtin/interop/blockchain/signer.py +++ b/boa3/builtin/interop/blockchain/signer.py @@ -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. @@ -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] """ @@ -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. @@ -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. diff --git a/boa3/builtin/interop/blockchain/transaction.py b/boa3/builtin/interop/blockchain/transaction.py index 2e6108d5e..145aafc71 100644 --- a/boa3/builtin/interop/blockchain/transaction.py +++ b/boa3/builtin/interop/blockchain/transaction.py @@ -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 diff --git a/boa3/builtin/interop/contract/__init__.py b/boa3/builtin/interop/contract/__init__.py index 556eafdf1..bdbbe7a35 100644 --- a/boa3/builtin/interop/contract/__init__.py +++ b/boa3/builtin/interop/contract/__init__.py @@ -17,15 +17,14 @@ from collections.abc import Sequence from typing import Any -from deprecation import deprecated - from boa3.builtin.interop.contract.callflagstype import CallFlags from boa3.builtin.interop.contract.contract import Contract from boa3.builtin.interop.contract.contractmanifest import ContractManifest from boa3.builtin.type import ECPoint, UInt160 +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.utils instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.utils` instead') def call_contract(script_hash: UInt160, method: str, args: Sequence = (), call_flags: CallFlags = CallFlags.ALL) -> Any: """ Calls a smart contract given the method and the arguments. Since the return is type Any, you'll probably need to @@ -35,13 +34,13 @@ def call_contract(script_hash: UInt160, method: str, args: Sequence = (), call_f 100 :param script_hash: the target smart contract's script hash - :type script_hash: UInt160 + :type script_hash: boa3.builtin.type.UInt160 :param method: the name of the method to be executed :type method: str :param args: the specified method's arguments :type args: Sequence[Any] :param call_flags: the CallFlags to be used to call the contract - :type call_flags: CallFlags + :type call_flags: boa3.builtin.interop.contract.callflagstype.CallFlags :return: the result of the specified method :rtype: Any @@ -52,7 +51,7 @@ def call_contract(script_hash: UInt160, method: str, args: Sequence = (), call_f pass -@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 create_contract(nef_file: bytes, manifest: bytes, data: Any = None) -> Contract: """ Creates a smart contract given the script and the manifest. @@ -83,14 +82,14 @@ def create_contract(nef_file: bytes, manifest: bytes, data: Any = None) -> Contr :type data: Any :return: the contract that was created - :rtype: Contract + :rtype: boa3.builtin.interop.contract.contract.Contract :raise Exception: raised if the nef or the manifest are not a valid smart contract. """ pass -@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 update_contract(nef_file: bytes, manifest: bytes, data: Any = None): """ Updates the executing smart contract given the script and the manifest. @@ -112,7 +111,7 @@ def update_contract(nef_file: bytes, manifest: bytes, data: Any = None): pass -@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 destroy_contract(): """ Destroy the executing smart contract. @@ -124,7 +123,7 @@ def destroy_contract(): pass -@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_minimum_deployment_fee() -> int: """ Gets the minimum fee of contract deployment. @@ -137,7 +136,7 @@ def get_minimum_deployment_fee() -> int: 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 get_call_flags() -> CallFlags: """ Gets the CallFlags in the current context. @@ -148,7 +147,7 @@ def get_call_flags() -> CallFlags: 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 create_standard_account(pub_key: ECPoint) -> UInt160: """ Calculates the script hash from a public key. @@ -157,15 +156,15 @@ def create_standard_account(pub_key: ECPoint) -> UInt160: b'\\r\\xa9g\\xa4\\x00C+\\xf2\\x7f\\x8e\\x8e\\xb4o\\xe8\\xace\\x9e\\xcc\\xde\\x04' :param pub_key: the given public key - :type pub_key: ECPoint + :type pub_key: boa3.builtin.type.ECPoint :return: the corresponding script hash of the public key - :rtype: UInt160 + :rtype: boa3.builtin.type.UInt160 """ 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 create_multisig_account(m: int, pub_keys: list[ECPoint]) -> UInt160: """ Calculates corresponding multisig account script hash for the given public keys. @@ -176,10 +175,10 @@ def create_multisig_account(m: int, pub_keys: list[ECPoint]) -> UInt160: :param m: the minimum number of correct signatures need to be provided in order for the verification to pass. :type m: int :param pub_keys: the public keys of the account - :type pub_keys: list[ECPoint] + :type pub_keys: list[boa3.builtin.type.ECPoint] :return: the hash of the corresponding account - :rtype: UInt160 + :rtype: boa3.builtin.type.UInt160 """ pass diff --git a/boa3/builtin/interop/contract/contract.py b/boa3/builtin/interop/contract/contract.py index ec750ba72..4274ae5e1 100644 --- a/boa3/builtin/interop/contract/contract.py +++ b/boa3/builtin/interop/contract/contract.py @@ -18,12 +18,12 @@ class Contract: :ivar update_counter: the number of times the contract was updated :vartype update_counter: int :ivar hash: the hash of the contract - :vartype hash: UInt160 + :vartype hash: boa3.builtin.type.UInt160 :ivar nef: the serialized Neo Executable Format (NEF) object holding of the smart contract code and compiler information :vartype nef: bytes :ivar manifest: the manifest of the contract - :vartype manifest: ContractManifest + :vartype manifest: boa3.builtin.interop.contract.ContractManifest """ def __init__(self): diff --git a/boa3/builtin/interop/contract/contractmanifest.py b/boa3/builtin/interop/contract/contractmanifest.py index 78febdf6d..f5e11342a 100644 --- a/boa3/builtin/interop/contract/contractmanifest.py +++ b/boa3/builtin/interop/contract/contractmanifest.py @@ -10,13 +10,12 @@ 'ContractParameterType', ] -from deprecation import deprecated - from boa3.builtin.type import ECPoint, UInt160 +from boa3.internal.deprecation import deprecated from boa3.internal.neo.vm.type.ContractParameterType import ContractParameterType -@deprecated(details='This module is deprecated. Use boa3.sc.types instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.types` instead') class ContractManifest: """ Represents the manifest of a smart contract. @@ -59,7 +58,7 @@ def __init__(self): self.extras: str = '' -@deprecated(details='This module is deprecated. Use boa3.sc.types instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.types` instead') class ContractPermission: """ Represents a permission of a contract. It describes which contracts may be invoked and which methods are called. @@ -91,15 +90,15 @@ def __init__(self): self.methods: list[str] | None = None -@deprecated(details='This module is deprecated. Use boa3.sc.types instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.types` instead') class ContractPermissionDescriptor: """ Indicates which contracts are authorized to be called. :ivar hash: The hash of the contract. - :vartype hash: UInt160 or None + :vartype hash: boa3.builtin.type.UInt160 or None :ivar group: The group of the contracts. - :vartype group: ECPoint or None + :vartype group: boa3.builtin.type.ECPoint or None """ def __init__(self): @@ -107,7 +106,7 @@ def __init__(self): self.group: ECPoint | None = None -@deprecated(details='This module is deprecated. Use boa3.sc.types instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.types` instead') class ContractGroup: """ Represents a set of mutually trusted contracts. @@ -119,7 +118,7 @@ class ContractGroup: the contract is indeed included in the group. :ivar pubkey: The public key of the group. - :vartype pubkey: ECPoint + :vartype pubkey: boa3.builtin.type.ECPoint :ivar signature: The signature of the contract hash which can be verified by `pubkey`. :vartype signature: bytes """ @@ -129,7 +128,7 @@ def __init__(self): self.signature: bytes = b'' -@deprecated(details='This module is deprecated. Use boa3.sc.types instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.types` instead') class ContractAbi: """ Represents the ABI of a smart contract. @@ -148,7 +147,7 @@ def __init__(self): self.events: list[ContractEventDescriptor] = [] -@deprecated(details='This module is deprecated. Use boa3.sc.types instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.types` instead') class ContractMethodDescriptor: """ Represents a method in a smart contract ABI. @@ -178,7 +177,7 @@ def __init__(self): self.safe: bool = False -@deprecated(details='This module is deprecated. Use boa3.sc.types instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.types` instead') class ContractEventDescriptor: """ Represents an event in a smart contract ABI. @@ -194,7 +193,7 @@ def __init__(self): self.parameters: list[ContractParameterDefinition] = [] -@deprecated(details='This module is deprecated. Use boa3.sc.types instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.types` instead') class ContractParameterDefinition: """ Represents a parameter of an event or method in ABI. diff --git a/boa3/builtin/interop/crypto/__init__.py b/boa3/builtin/interop/crypto/__init__.py index e4a960d4c..bae1d8973 100644 --- a/boa3/builtin/interop/crypto/__init__.py +++ b/boa3/builtin/interop/crypto/__init__.py @@ -19,14 +19,13 @@ from typing import Any -from deprecation import deprecated - from boa3.builtin.interop.crypto.ibls12381 import IBls12381 from boa3.builtin.interop.crypto.namedcurve import NamedCurveHash from boa3.builtin.type import ECPoint +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use CryptoLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`CryptoLib` from :mod:`boa3.sc.contracts` instead') def sha256(key: Any) -> bytes: """ Encrypts a key using SHA-256. @@ -45,7 +44,7 @@ def sha256(key: Any) -> bytes: pass -@deprecated(details='This module is deprecated. Use CryptoLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`CryptoLib` from :mod:`boa3.sc.contracts` instead') def ripemd160(key: Any) -> bytes: """ Encrypts a key using RIPEMD-160. @@ -64,7 +63,7 @@ def ripemd160(key: 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 hash160(key: Any) -> bytes: """ Encrypts a key using HASH160. @@ -83,7 +82,7 @@ def hash160(key: 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 hash256(key: Any) -> bytes: """ Encrypts a key using HASH256. @@ -102,7 +101,7 @@ def hash256(key: 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 check_sig(pub_key: ECPoint, signature: bytes) -> bool: """ Checks the signature for the current script container. @@ -112,7 +111,7 @@ def check_sig(pub_key: ECPoint, signature: bytes) -> bool: False :param pub_key: the public key of the account - :type pub_key: ECPoint + :type pub_key: boa3.builtin.type.ECPoint :param signature: the signature of the current script container :type signature: bytes :return: whether the signature is valid or not @@ -121,7 +120,7 @@ def check_sig(pub_key: ECPoint, signature: bytes) -> bool: 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 check_multisig(pubkeys: list[ECPoint], signatures: list[bytes]) -> bool: """ Checks the signatures for the current script container. @@ -132,7 +131,7 @@ def check_multisig(pubkeys: list[ECPoint], signatures: list[bytes]) -> bool: False :param pubkeys: a list of public keys - :type pubkeys: list[ECPoint] + :type pubkeys: list[boa3.builtin.type.ECPoint] :param signatures: a list of signatures :type signatures: list[bytes] :return: a boolean value that represents whether the signatures were validated @@ -141,7 +140,7 @@ def check_multisig(pubkeys: list[ECPoint], signatures: list[bytes]) -> bool: pass -@deprecated(details='This module is deprecated. Use CryptoLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`CryptoLib` from :mod:`boa3.sc.contracts` instead') def verify_with_ecdsa(message: bytes, pubkey: ECPoint, signature: bytes, curve: NamedCurveHash) -> bool: """ Using the elliptic curve, it checks if the signature of the message was originally produced by the public key. @@ -153,18 +152,18 @@ def verify_with_ecdsa(message: bytes, pubkey: ECPoint, signature: bytes, curve: :param message: the encrypted message :type message: bytes :param pubkey: the public key that might have created the item - :type pubkey: ECPoint + :type pubkey: boa3.builtin.type.ECPoint :param signature: the signature of the item :type signature: bytes :param curve: the curve that will be used by the ecdsa - :type curve: NamedCurveHash + :type curve: boa3.builtin.interop.crypto.namedcurve.NamedCurveHash :return: a boolean value that represents whether the signature is valid :rtype: bool """ pass -@deprecated(details='This module is deprecated. Use CryptoLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`CryptoLib` from :mod:`boa3.sc.contracts` instead') def murmur32(data: bytes, seed: int) -> bytes: """ Computes the hash value for the specified byte array using the murmur32 algorithm. @@ -182,7 +181,7 @@ def murmur32(data: bytes, seed: int) -> bytes: pass -@deprecated(details='This module is deprecated. Use CryptoLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`CryptoLib` from :mod:`boa3.sc.contracts` instead') def bls12_381_add(x: IBls12381, y: IBls12381) -> IBls12381: """ Add operation of two bls12381 points. @@ -197,7 +196,7 @@ def bls12_381_add(x: IBls12381, y: IBls12381) -> IBls12381: pass -@deprecated(details='This module is deprecated. Use CryptoLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`CryptoLib` from :mod:`boa3.sc.contracts` instead') def bls12_381_deserialize(data: bytes) -> IBls12381: """ Deserialize a bls12381 point. @@ -210,7 +209,7 @@ def bls12_381_deserialize(data: bytes) -> IBls12381: pass -@deprecated(details='This module is deprecated. Use CryptoLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`CryptoLib` from :mod:`boa3.sc.contracts` instead') def bls12_381_equal(x: IBls12381, y: IBls12381) -> bool: """ Determines whether the specified points are equal. @@ -225,7 +224,7 @@ def bls12_381_equal(x: IBls12381, y: IBls12381) -> bool: pass -@deprecated(details='This module is deprecated. Use CryptoLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`CryptoLib` from :mod:`boa3.sc.contracts` instead') def bls12_381_mul(x: IBls12381, mul: bytes, neg: bool) -> IBls12381: """ Mul operation of gt point and multiplier. @@ -242,7 +241,7 @@ def bls12_381_mul(x: IBls12381, mul: bytes, neg: bool) -> IBls12381: pass -@deprecated(details='This module is deprecated. Use CryptoLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`CryptoLib` from :mod:`boa3.sc.contracts` instead') def bls12_381_pairing(g1: IBls12381, g2: IBls12381) -> IBls12381: """ Pairing operation of g1 and g2. @@ -257,7 +256,7 @@ def bls12_381_pairing(g1: IBls12381, g2: IBls12381) -> IBls12381: pass -@deprecated(details='This module is deprecated. Use CryptoLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`CryptoLib` from :mod:`boa3.sc.contracts` instead') def bls12_381_serialize(g: IBls12381) -> bytes: """ Serialize a bls12381 point. diff --git a/boa3/builtin/interop/crypto/ibls12381.py b/boa3/builtin/interop/crypto/ibls12381.py index 1c531697f..6aed9c8ba 100644 --- a/boa3/builtin/interop/crypto/ibls12381.py +++ b/boa3/builtin/interop/crypto/ibls12381.py @@ -1,7 +1,7 @@ -from deprecation import deprecated +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 IBls12381: def __init__(self): diff --git a/boa3/builtin/interop/iterator/__init__.py b/boa3/builtin/interop/iterator/__init__.py index fc21e85ea..40e62e956 100644 --- a/boa3/builtin/interop/iterator/__init__.py +++ b/boa3/builtin/interop/iterator/__init__.py @@ -6,10 +6,10 @@ from typing import Any -from deprecation import deprecated +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.utils instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.utils` instead') class Iterator: """ The iterator for smart contracts. diff --git a/boa3/builtin/interop/json/__init__.py b/boa3/builtin/interop/json/__init__.py index 6501ef05b..7a99758a0 100644 --- a/boa3/builtin/interop/json/__init__.py +++ b/boa3/builtin/interop/json/__init__.py @@ -5,10 +5,10 @@ from typing import Any -from deprecation import deprecated +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def json_serialize(item: Any) -> str: """ Serializes an item into a json. @@ -27,7 +27,7 @@ def json_serialize(item: Any) -> str: pass -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def json_deserialize(json: str) -> Any: """ Deserializes a json into some valid type. diff --git a/boa3/builtin/interop/policy/__init__.py b/boa3/builtin/interop/policy/__init__.py index 8446c857e..00fdc402e 100644 --- a/boa3/builtin/interop/policy/__init__.py +++ b/boa3/builtin/interop/policy/__init__.py @@ -5,12 +5,11 @@ 'is_blocked', ] -from deprecation import deprecated - from boa3.builtin.type import UInt160 +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use PolicyContract from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`PolicyContract` from :mod:`boa3.sc.contracts` instead') def get_exec_fee_factor() -> int: """ Gets the execution fee factor. This is a multiplier that can be adjusted by the committee to adjust the system fees @@ -25,7 +24,7 @@ def get_exec_fee_factor() -> int: pass -@deprecated(details='This module is deprecated. Use PolicyContract from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`PolicyContract` from :mod:`boa3.sc.contracts` instead') def get_fee_per_byte() -> int: """ Gets the network fee per transaction byte. @@ -39,7 +38,7 @@ def get_fee_per_byte() -> int: pass -@deprecated(details='This module is deprecated. Use PolicyContract from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`PolicyContract` from :mod:`boa3.sc.contracts` instead') def get_storage_price() -> int: """ Gets the storage price. @@ -53,7 +52,7 @@ def get_storage_price() -> int: pass -@deprecated(details='This module is deprecated. Use PolicyContract from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`PolicyContract` from :mod:`boa3.sc.contracts` instead') def is_blocked(account: UInt160) -> bool: """ Determines whether the specified account is blocked. @@ -62,7 +61,7 @@ def is_blocked(account: UInt160) -> bool: False :param account: the account to be checked - :type account: UInt160 + :type account: boa3.builtin.type.UInt160 :return: whether the account is blocked or not :rtype: bool diff --git a/boa3/builtin/interop/role/__init__.py b/boa3/builtin/interop/role/__init__.py index c016310b8..bb2ca36a8 100644 --- a/boa3/builtin/interop/role/__init__.py +++ b/boa3/builtin/interop/role/__init__.py @@ -3,13 +3,12 @@ 'get_designated_by_role', ] -from deprecation import deprecated - from boa3.builtin.interop.role.roletype import Role from boa3.builtin.type import ECPoint +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use RoleManagement from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`RoleManagement` from :mod:`boa3.sc.contracts` instead') def get_designated_by_role(role: Role, index: int) -> ECPoint: """ Gets the list of nodes for the specified role. @@ -18,11 +17,11 @@ def get_designated_by_role(role: Role, index: int) -> ECPoint: [] :param role: the type of the role - :type role: Role + :type role: boa3.builtin.interop.role.roletype.Role :param index: the index of the block to be queried :type index: int :return: the public keys of the nodes - :rtype: ECPoint + :rtype: boa3.builtin.type.ECPoint """ pass diff --git a/boa3/builtin/interop/runtime/__init__.py b/boa3/builtin/interop/runtime/__init__.py index bdda0f073..cd52d58ed 100644 --- a/boa3/builtin/interop/runtime/__init__.py +++ b/boa3/builtin/interop/runtime/__init__.py @@ -24,16 +24,15 @@ from collections.abc import Sequence from typing import Any -from deprecation import deprecated - from boa3.builtin.interop.blockchain import Transaction from boa3.builtin.interop.contract.callflagstype import CallFlags from boa3.builtin.interop.runtime.notification import Notification from boa3.builtin.interop.runtime.triggertype import TriggerType from boa3.builtin.type import ECPoint, UInt160 +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.runtime instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.runtime` instead') def check_witness(hash_or_pubkey: UInt160 | ECPoint) -> bool: """ Verifies that the transactions or block of the calling contract has validated the required script hash. @@ -45,14 +44,14 @@ def check_witness(hash_or_pubkey: UInt160 | ECPoint) -> bool: False :param hash_or_pubkey: script hash or public key to validate - :type hash_or_pubkey: UInt160 or ECPoint + :type hash_or_pubkey: boa3.builtin.type.UInt160 or boa3.builtin.type.ECPoint :return: a boolean value that represents whether the script hash was verified :rtype: bool """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.runtime instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.runtime` instead') def notify(state: Any, notification_name: str = None): """ Notifies the client from the executing smart contract. @@ -73,7 +72,7 @@ def notify(state: Any, notification_name: str = None): pass -@deprecated(details='This module is deprecated. Use boa3.sc.runtime instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.runtime` instead') def log(message: str): """ Show log messages to the client from the executing smart contract. @@ -87,7 +86,7 @@ def log(message: str): pass -@deprecated(details='This module is deprecated. Use boa3.sc.runtime instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.runtime` instead') def get_trigger() -> TriggerType: """ Return the smart contract trigger type. @@ -96,12 +95,12 @@ def get_trigger() -> TriggerType: TriggerType.APPLICATION :return: a value that represents the contract trigger type - :rtype: TriggerType + :rtype: boa3.builtin.interop.runtime.triggertype.TriggerType """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.runtime instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.runtime` instead') def get_notifications(script_hash: UInt160 = UInt160()) -> list[Notification]: """ This method gets current invocation notifications from specific 'script_hash'. @@ -128,14 +127,14 @@ def get_notifications(script_hash: UInt160 = UInt160()) -> list[Notification]: :param script_hash: must have 20 bytes, but if it's all zero 0000...0000 it refers to all existing notifications (like a * wildcard) - :type script_hash: UInt160 + :type script_hash: boa3.builtin.type.UInt160 :return: It will return an array of all matched notifications - :rtype: list[Notification] + :rtype: list[boa3.builtin.interop.runtime.notification.Notification] """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.runtime instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.runtime` instead') def get_network() -> int: """ Gets the magic number of the current network. @@ -149,7 +148,7 @@ def get_network() -> int: pass -@deprecated(details='This module is deprecated. Use boa3.sc.runtime instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.runtime` instead') def burn_gas(gas: int): """ Burns GAS to benefit the NEO ecosystem. @@ -165,7 +164,7 @@ def burn_gas(gas: int): pass -@deprecated(details='This module is deprecated. Use boa3.sc.runtime instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.runtime` instead') def get_random() -> int: """ Gets the next random number. @@ -185,7 +184,7 @@ def get_random() -> int: pass -@deprecated(details='This module is deprecated. Use boa3.sc.runtime instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.runtime` instead') def load_script(script: bytes, args: Sequence = (), flags: CallFlags = CallFlags.NONE) -> Any: """ Loads a script at runtime. diff --git a/boa3/builtin/interop/runtime/notification.py b/boa3/builtin/interop/runtime/notification.py index d3f969118..210210d43 100644 --- a/boa3/builtin/interop/runtime/notification.py +++ b/boa3/builtin/interop/runtime/notification.py @@ -1,17 +1,16 @@ __all__ = ['Notification'] -from deprecation import deprecated - 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 Notification: """ Represents a notification. :ivar script_hash: the script hash of the notification sender - :vartype script_hash: UInt160 + :vartype script_hash: boa3.builtin.type.UInt160 :ivar event_name: the notification's name :vartype event_name: str :ivar state: a tuple value storing all the notification contents. diff --git a/boa3/builtin/interop/stdlib/__init__.py b/boa3/builtin/interop/stdlib/__init__.py index 6c7cade81..3ca4bea02 100644 --- a/boa3/builtin/interop/stdlib/__init__.py +++ b/boa3/builtin/interop/stdlib/__init__.py @@ -15,10 +15,10 @@ from typing import Any -from deprecation import deprecated +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def base58_encode(key: bytes) -> str: """ Encodes a bytes value using base58. @@ -34,7 +34,7 @@ def base58_encode(key: bytes) -> str: pass -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def base58_decode(key: str) -> bytes: """ Decodes a string value encoded with base58. @@ -50,7 +50,7 @@ def base58_decode(key: str) -> bytes: pass -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def base58_check_encode(key: bytes) -> str: """ Converts a bytes value to its equivalent str representation that is encoded with base-58 digits. The encoded str @@ -67,7 +67,7 @@ def base58_check_encode(key: bytes) -> str: pass -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def base58_check_decode(key: str) -> bytes: """ Converts the specified str, which encodes binary data as base-58 digits, to an equivalent bytes value. The encoded @@ -84,7 +84,7 @@ def base58_check_decode(key: str) -> bytes: pass -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def base64_encode(key: bytes) -> str: """ Encodes a bytes value using base64. @@ -100,7 +100,7 @@ def base64_encode(key: bytes) -> str: pass -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def base64_decode(key: str) -> bytes: """ Decodes a string value encoded with base64. @@ -116,7 +116,7 @@ def base64_decode(key: str) -> bytes: pass -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def serialize(item: Any) -> bytes: """ Serializes the given value into its bytes representation. @@ -143,7 +143,7 @@ def serialize(item: Any) -> bytes: pass -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def deserialize(data: bytes) -> Any: """ Deserializes the given bytes value. @@ -170,7 +170,7 @@ def deserialize(data: bytes) -> Any: pass -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def atoi(value: str, base: int = 10) -> int: """ Converts a character string to a specific base value, decimal or hexadecimal. The default is decimal. @@ -199,7 +199,7 @@ def atoi(value: str, base: int = 10) -> int: pass -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def itoa(value: int, base: int = 10) -> str: """ Converts the specific type of value to a decimal or hexadecimal string. The default is decimal. @@ -226,7 +226,7 @@ def itoa(value: int, base: int = 10) -> str: pass -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def memory_search(mem: bytes | str, value: bytes | str, start: int = 0, backward: bool = False) -> int: """ Searches for a given value in a given memory. @@ -252,7 +252,7 @@ def memory_search(mem: bytes | str, value: bytes | str, start: int = 0, backward pass -@deprecated(details='This module is deprecated. Use StdLib from boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :class:`StdLib` from :mod:`boa3.sc.contracts` instead') def memory_compare(mem1: bytes | str, mem2: bytes | str) -> int: """ Compares a memory with another one. diff --git a/boa3/builtin/interop/storage/__init__.py b/boa3/builtin/interop/storage/__init__.py index 97fb4f3d0..ed5efa928 100644 --- a/boa3/builtin/interop/storage/__init__.py +++ b/boa3/builtin/interop/storage/__init__.py @@ -40,16 +40,15 @@ from typing import Any -from deprecation import deprecated - from boa3.builtin.interop.iterator import Iterator from boa3.builtin.interop.storage.findoptions import FindOptions from boa3.builtin.interop.storage.storagecontext import StorageContext from boa3.builtin.interop.storage.storagemap import StorageMap from boa3.builtin.type import UInt160, UInt256, ECPoint +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def get_context() -> StorageContext: """ Gets current storage context. @@ -58,12 +57,12 @@ def get_context() -> StorageContext: _InteropInterface :return: the current storage context - :rtype: StorageContext + :rtype: boa3.builtin.interop.storage.storagecontext.StorageContext """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def get(key: bytes, context: StorageContext = get_context()) -> bytes: """ Gets a value from the persistent store based on the given key. @@ -78,14 +77,14 @@ def get(key: bytes, context: StorageContext = get_context()) -> bytes: :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context :rtype: bytes """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def try_get(key: bytes, context: StorageContext = get_context()) -> tuple[bytes, bool]: """ Gets a value from the persistent store based on the given key and returns whether the value is stored. @@ -100,14 +99,14 @@ def try_get(key: bytes, context: StorageContext = get_context()) -> tuple[bytes, :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context and whether it was actually stored :rtype: tuple[bytes, bool] """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def get_int(key: bytes, context: StorageContext = get_context()) -> int: """ Gets a value as integer from the persistent store based on the given key. @@ -123,14 +122,14 @@ def get_int(key: bytes, context: StorageContext = get_context()) -> int: :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context :rtype: int """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def try_get_int(key: bytes, context: StorageContext = get_context()) -> tuple[int, bool]: """ Gets a value as integer from the persistent store based on the given key and returns whether the value is stored. @@ -145,14 +144,14 @@ def try_get_int(key: bytes, context: StorageContext = get_context()) -> tuple[in :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context and whether it was actually stored :rtype: tuple[int, bool] """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def get_bool(key: bytes, context: StorageContext = get_context()) -> bool: """ Gets a value as boolean from the persistent store based on the given key. @@ -168,14 +167,14 @@ def get_bool(key: bytes, context: StorageContext = get_context()) -> bool: :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context :rtype: bool """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def try_get_bool(key: bytes, context: StorageContext = get_context()) -> tuple[bool, bool]: """ Gets a value as boolean from the persistent store based on the given key and returns whether the value is stored. @@ -190,14 +189,14 @@ def try_get_bool(key: bytes, context: StorageContext = get_context()) -> tuple[b :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context and whether it was actually stored :rtype: tuple[bool, bool] """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def get_str(key: bytes, context: StorageContext = get_context()) -> str: """ Gets a value as string from the persistent store based on the given key. @@ -213,14 +212,14 @@ def get_str(key: bytes, context: StorageContext = get_context()) -> str: :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context :rtype: str """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def try_get_str(key: bytes, context: StorageContext = get_context()) -> tuple[str, bool]: """ Gets a value as string from the persistent store based on the given key and returns whether the value is stored. @@ -235,14 +234,14 @@ def try_get_str(key: bytes, context: StorageContext = get_context()) -> tuple[st :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context and whether it was actually stored :rtype: tuple[str, bool] """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def get_list(key: bytes, context: StorageContext = get_context()) -> list: """ Gets a value as list from the persistent store based on the given key. @@ -258,14 +257,14 @@ def get_list(key: bytes, context: StorageContext = get_context()) -> list: :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context :rtype: list """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def try_get_list(key: bytes, context: StorageContext = get_context()) -> tuple[list, bool]: """ Gets a value as list from the persistent store based on the given key and returns whether the value is stored. @@ -280,14 +279,14 @@ def try_get_list(key: bytes, context: StorageContext = get_context()) -> tuple[l :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context and whether it was actually stored :rtype: tuple[list, bool] """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def get_dict(key: bytes, context: StorageContext = get_context()) -> dict: """ Gets a value as dict from the persistent store based on the given key. @@ -303,14 +302,14 @@ def get_dict(key: bytes, context: StorageContext = get_context()) -> dict: :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context :rtype: dict """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def try_get_dict(key: bytes, context: StorageContext = get_context()) -> tuple[dict, bool]: """ Gets a value as dict from the persistent store based on the given key and returns whether the value is stored. @@ -325,14 +324,14 @@ def try_get_dict(key: bytes, context: StorageContext = get_context()) -> tuple[d :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context and whether it was actually stored :rtype: tuple[dict, bool] """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def get_object(key: bytes, context: StorageContext = get_context()) -> Any: """ Gets a value as object from the persistent store based on the given key. @@ -350,14 +349,14 @@ def get_object(key: bytes, context: StorageContext = get_context()) -> Any: :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context :rtype: Any """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def try_get_object(key: bytes, context: StorageContext = get_context()) -> tuple[Any, bool]: """ Gets a value as dict from the persistent store based on the given key and returns whether the value is stored. @@ -373,14 +372,14 @@ def try_get_object(key: bytes, context: StorageContext = get_context()) -> tuple :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context and whether it was actually stored :rtype: tuple[Any, bool] """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def get_uint160(key: bytes, context: StorageContext = get_context()) -> UInt160: """ Gets a value as UInt160 from the persistent store based on the given key. @@ -396,14 +395,14 @@ def get_uint160(key: bytes, context: StorageContext = get_context()) -> UInt160: :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context - :rtype: UInt160 + :rtype: boa3.builtin.type.UInt160 """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def try_get_uint160(key: bytes, context: StorageContext = get_context()) -> tuple[UInt160, bool]: """ Gets a value as UInt160 from the persistent store based on the given key and returns whether the value is stored. @@ -418,14 +417,14 @@ def try_get_uint160(key: bytes, context: StorageContext = get_context()) -> tupl :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context and whether it was actually stored - :rtype: tuple[UInt160, bool] + :rtype: tuple[boa3.builtin.type.UInt160, bool] """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def get_uint256(key: bytes, context: StorageContext = get_context()) -> UInt256: """ Gets a value as UInt256 from the persistent store based on the given key. @@ -441,14 +440,14 @@ def get_uint256(key: bytes, context: StorageContext = get_context()) -> UInt256: :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context - :rtype: UInt256 + :rtype: boa3.builtin.type.UInt256 """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def try_get_uint256(key: bytes, context: StorageContext = get_context()) -> tuple[UInt256, bool]: """ Gets a value as UInt256 from the persistent store based on the given key and returns whether the value is stored. @@ -463,14 +462,14 @@ def try_get_uint256(key: bytes, context: StorageContext = get_context()) -> tupl :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context and whether it was actually stored - :rtype: tuple[UInt256, bool] + :rtype: tuple[boa3.builtin.type.UInt256, bool] """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def get_ecpoint(key: bytes, context: StorageContext = get_context()) -> ECPoint: """ Gets a value as ECPoint from the persistent store based on the given key. @@ -486,14 +485,14 @@ def get_ecpoint(key: bytes, context: StorageContext = get_context()) -> ECPoint: :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context - :rtype: ECPoint + :rtype: boa3.builtin.type.ECPoint """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def try_get_ecpoint(key: bytes, context: StorageContext = get_context()) -> tuple[ECPoint, bool]: """ Gets a value as ECPoint from the persistent store based on the given key and returns whether the value is stored. @@ -508,14 +507,14 @@ def try_get_ecpoint(key: bytes, context: StorageContext = get_context()) -> tupl :param key: value identifier in the store :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :return: the value corresponding to given key for current storage context and whether it was actually stored - :rtype: tuple[ECPoint, bool] + :rtype: tuple[boa3.builtin.type.ECPoint, bool] """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def get_read_only_context() -> StorageContext: """ Gets current read only storage context. @@ -524,12 +523,12 @@ def get_read_only_context() -> StorageContext: _InteropInterface :return: the current read only storage context - :rtype: StorageContext + :rtype: boa3.builtin.interop.storage.storagecontext.StorageContext """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def put(key: bytes, value: bytes, context: StorageContext = get_context()): """ Inserts a given bytes value in the key-value format into the persistent storage. @@ -542,12 +541,12 @@ def put(key: bytes, value: bytes, context: StorageContext = get_context()): :param value: value to be stored :type value: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def put_int(key: bytes, value: int, context: StorageContext = get_context()): """ Inserts a given integer value in the key-value format into the persistent storage. @@ -561,12 +560,12 @@ def put_int(key: bytes, value: int, context: StorageContext = get_context()): :param value: value to be stored :type value: int :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def put_bool(key: bytes, value: bool, context: StorageContext = get_context()): """ Inserts a given boolean value in the key-value format into the persistent storage. @@ -580,12 +579,12 @@ def put_bool(key: bytes, value: bool, context: StorageContext = get_context()): :param value: value to be stored :type value: bool :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def put_str(key: bytes, value: str, context: StorageContext = get_context()): """ Inserts a given str value in the key-value format into the persistent storage. @@ -599,12 +598,12 @@ def put_str(key: bytes, value: str, context: StorageContext = get_context()): :param value: value to be stored :type value: str :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def put_list(key: bytes, value: list, context: StorageContext = get_context()): """ Inserts a given list value in the key-value format into the persistent storage. @@ -618,12 +617,12 @@ def put_list(key: bytes, value: list, context: StorageContext = get_context()): :param value: value to be stored :type value: list :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def put_dict(key: bytes, value: dict, context: StorageContext = get_context()): """ Inserts a given dict value in the key-value format into the persistent storage. @@ -637,12 +636,12 @@ def put_dict(key: bytes, value: dict, context: StorageContext = get_context()): :param value: value to be stored :type value: dict :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def put_object(key: bytes, value: object, context: StorageContext = get_context()): """ Inserts a given object value in the key-value format into the persistent storage. @@ -657,12 +656,12 @@ def put_object(key: bytes, value: object, context: StorageContext = get_context( :param value: value to be stored :type value: dict :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def put_uint160(key: bytes, value: UInt160, context: StorageContext = get_context()): """ Inserts a given UInt160 value in the key-value format into the persistent storage. @@ -674,14 +673,14 @@ def put_uint160(key: bytes, value: UInt160, context: StorageContext = get_contex :param key: the identifier in the store for the new value :type key: bytes :param value: value to be stored - :type value: UInt160 + :type value: boa3.builtin.type.UInt160 :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def put_uint256(key: bytes, value: UInt256, context: StorageContext = get_context()): """ Inserts a given UInt256 value in the key-value format into the persistent storage. @@ -693,14 +692,14 @@ def put_uint256(key: bytes, value: UInt256, context: StorageContext = get_contex :param key: the identifier in the store for the new value :type key: bytes :param value: value to be stored - :type value: UInt256 + :type value: boa3.builtin.type.UInt256 :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def put_ecpoint(key: bytes, value: ECPoint, context: StorageContext = get_context()): """ Inserts a given ECPoint value in the key-value format into the persistent storage. @@ -712,14 +711,14 @@ def put_ecpoint(key: bytes, value: ECPoint, context: StorageContext = get_contex :param key: the identifier in the store for the new value :type key: bytes :param value: value to be stored - :type value: ECPoint + :type value: boa3.builtin.type.ECPoint :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def delete(key: bytes, context: StorageContext = get_context()): """ Removes a given key from the persistent storage if exists. @@ -732,12 +731,12 @@ def delete(key: bytes, context: StorageContext = get_context()): :param key: the identifier in the store for the new value :type key: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext """ pass -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') def find(prefix: bytes, context: StorageContext = get_context(), options: FindOptions = FindOptions.NONE) -> Iterator: @@ -758,10 +757,10 @@ def find(prefix: bytes, :param prefix: prefix to find the storage keys :type prefix: bytes :param context: storage context to be used - :type context: StorageContext + :type context: boa3.builtin.interop.storage.storagecontext.StorageContext :param options: the options of the search - :type options: FindOptions + :type options: boa3.builtin.interop.storage.findoptions.FindOptions.FindOptions :return: an iterator with the search results - :rtype: Iterator + :rtype: boa3.builtin.interop.iterator.Iterator """ pass diff --git a/boa3/builtin/interop/storage/storagecontext.py b/boa3/builtin/interop/storage/storagecontext.py index 0419b4b31..6c0359619 100644 --- a/boa3/builtin/interop/storage/storagecontext.py +++ b/boa3/builtin/interop/storage/storagecontext.py @@ -2,12 +2,11 @@ __all__ = ['StorageContext'] -from deprecation import deprecated - from boa3.builtin.interop.storage.storagemap import StorageMap +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') class StorageContext: """ The storage context used to read and write data in smart contracts. @@ -26,7 +25,7 @@ def create_map(self, prefix: bytes) -> StorageMap: :param prefix: the identifier of the storage map :type prefix: bytes :return: a map with the key-values in the storage that match with the given prefix - :rtype: StorageMap + :rtype: boa3.builtin.interop.storage.storagemap.StorageMap """ pass diff --git a/boa3/builtin/interop/storage/storagemap.py b/boa3/builtin/interop/storage/storagemap.py index 3f622b24c..5fcfb6b8c 100644 --- a/boa3/builtin/interop/storage/storagemap.py +++ b/boa3/builtin/interop/storage/storagemap.py @@ -1,9 +1,9 @@ __all__ = ['StorageMap'] -from deprecation import deprecated +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.storage instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.storage` instead') class StorageMap: """ The key-value storage for the specific prefix in the given storage context. diff --git a/boa3/builtin/math.py b/boa3/builtin/math.py index 2811ce5b2..ba6c2b3de 100644 --- a/boa3/builtin/math.py +++ b/boa3/builtin/math.py @@ -1,7 +1,7 @@ -from deprecation import deprecated +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.math instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.math` instead') def ceil(x: int, decimals: int) -> int: """ Return the ceiling of x given the amount of decimals. @@ -22,7 +22,7 @@ def ceil(x: int, decimals: int) -> int: pass -@deprecated(details='This module is deprecated. Use boa3.sc.math instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.math` instead') def floor(x: int, decimals: int) -> int: """ Return the floor of x given the amount of decimals. @@ -43,7 +43,7 @@ def floor(x: int, decimals: int) -> int: pass -@deprecated(details='This module is deprecated. Use boa3.sc.math instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.math` instead') def sqrt(x: int) -> int: """ Gets the square root of a number. diff --git a/boa3/builtin/nativecontract/contractmanagement.py b/boa3/builtin/nativecontract/contractmanagement.py index 386da6b4e..9ac4c9328 100644 --- a/boa3/builtin/nativecontract/contractmanagement.py +++ b/boa3/builtin/nativecontract/contractmanagement.py @@ -5,13 +5,12 @@ 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.contracts instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.contracts` instead') class ContractManagement: """ A class used to represent the ContractManagement native contract. @@ -61,9 +60,9 @@ def get_contract(cls, script_hash: UInt160) -> Contract | None: None :param script_hash: a smart contract hash - :type script_hash: UInt160 + :type script_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. """ @@ -87,7 +86,7 @@ def has_method(cls, hash: UInt160, method: str, parameter_count: int) -> bool: False :param hash: The hash of the deployed contract - :type hash: UInt160 + :type hash: boa3.builtin.type.UInt160 :param method: The name of the method :type method: str :param parameter_count: The number of parameters @@ -130,7 +129,7 @@ def deploy(cls, nef_file: bytes, manifest: bytes, data: Any = None) -> Contract: :type data: Any :return: the contract that was created - :rtype: Contract + :rtype: boa3.builtin.interop.contract.contract.Contract :raise Exception: raised if the nef or the manifest are not a valid smart contract. """ diff --git a/boa3/builtin/nativecontract/cryptolib.py b/boa3/builtin/nativecontract/cryptolib.py index d5cd8c6cd..414cc828b 100644 --- a/boa3/builtin/nativecontract/cryptolib.py +++ b/boa3/builtin/nativecontract/cryptolib.py @@ -6,13 +6,12 @@ from typing import Any -from deprecation import deprecated - from boa3.builtin.interop.crypto import NamedCurveHash, IBls12381 from boa3.builtin.type import ECPoint, UInt160 +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.contracts` instead') class CryptoLib: """ A class used to represent the CryptoLib native contract. @@ -88,11 +87,11 @@ def verify_with_ecdsa(cls, message: bytes, pubkey: ECPoint, signature: bytes, cu :param message: the encrypted message :type message: bytes :param pubkey: the public key that might have created the item - :type pubkey: ECPoint + :type pubkey: boa3.builtin.type.ECPoint :param signature: the signature of the item :type signature: bytes :param curve: the curve that will be used by the ecdsa - :type curve: NamedCurveHash + :type curve: boa3.builtin.interop.crypto.namedcurveNamedCurveHash :return: a boolean value that represents whether the signature is valid :rtype: bool """ diff --git a/boa3/builtin/nativecontract/gas.py b/boa3/builtin/nativecontract/gas.py index 19464b40d..8a15d271c 100644 --- a/boa3/builtin/nativecontract/gas.py +++ b/boa3/builtin/nativecontract/gas.py @@ -4,12 +4,11 @@ from typing import Any -from deprecation import deprecated - from boa3.builtin.type import UInt160 +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.contracts` instead') class GAS: """ A class used to represent the GAS native contract. @@ -74,7 +73,7 @@ def balanceOf(cls, account: UInt160) -> int: 1000000000 :param account: the account's address to retrieve the balance for - :type account: UInt160 + :type account: boa3.builtin.type.UInt160 :return: the account's balance :rtype: int """ @@ -104,9 +103,9 @@ def transfer(cls, from_address: UInt160, to_address: UInt160, amount: int, data: False :param from_address: the address to transfer from - :type from_address: UInt160 + :type from_address: boa3.builtin.type.UInt160 :param to_address: the address to transfer to - :type to_address: UInt160 + :type to_address: boa3.builtin.type.UInt160 :param amount: the amount of GAS to transfer :type amount: int :param data: whatever data is pertinent to the onNEP17Payment method diff --git a/boa3/builtin/nativecontract/ledger.py b/boa3/builtin/nativecontract/ledger.py index 1d2bd9373..6bf6408a9 100644 --- a/boa3/builtin/nativecontract/ledger.py +++ b/boa3/builtin/nativecontract/ledger.py @@ -2,13 +2,12 @@ 'Ledger', ] -from deprecation import deprecated - from boa3.builtin.interop.blockchain import Block, Signer, Transaction, VMState from boa3.builtin.type import UInt256, UInt160 +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.contracts` instead') class Ledger: """ A class used to represent the Ledger native contract. @@ -59,9 +58,9 @@ def get_block(cls, 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 @@ -93,7 +92,7 @@ def get_current_hash(cls) -> UInt256: b'\\x3e\\x65\\xe5\\x4d\\x75\\x5a\\x94\\x90\\xd6\\x98\\x3a\\x77\\xe4\\x82\\xaf\\x7a\\x38\\xc9\\x8c\\x1a\\xc6\\xd9\\xda\\x48\\xbd\\x7c\\x22\\xb3\\x2a\\x9e\\x34\\xea' :return: the hash of the current block - :rtype: UInt256 + :rtype: boa3.builtin.type.UInt256 """ pass @@ -118,7 +117,7 @@ def get_transaction(cls, 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 @@ -159,7 +158,7 @@ def get_transaction_from_block(cls, block_hash_or_height: UInt256 | int, tx_inde 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 @@ -181,7 +180,7 @@ def get_transaction_height(cls, 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 @@ -203,7 +202,7 @@ def get_transaction_signers(cls, 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 @@ -217,7 +216,7 @@ def get_transaction_vm_state(cls, 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 diff --git a/boa3/builtin/nativecontract/neo.py b/boa3/builtin/nativecontract/neo.py index 7001e4664..b63cd9488 100644 --- a/boa3/builtin/nativecontract/neo.py +++ b/boa3/builtin/nativecontract/neo.py @@ -4,14 +4,13 @@ from typing import Any -from deprecation import deprecated - from boa3.builtin.contract import NeoAccountState from boa3.builtin.interop.iterator import Iterator from boa3.builtin.type import ECPoint, UInt160 +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.contracts` instead') class NEO: """ A class used to represent the NEO native contract. @@ -73,7 +72,7 @@ def balanceOf(cls, account: UInt160) -> int: 100 :param account: the account's address to retrieve the balance for - :type account: UInt160 + :type account: boa3.builtin.type.UInt160 :return: the account's balance :rtype: int """ @@ -104,9 +103,9 @@ def transfer(cls, from_address: UInt160, to_address: UInt160, amount: int, data: :param from_address: the address to transfer from - :type from_address: UInt160 + :type from_address: boa3.builtin.type.UInt160 :param to_address: the address to transfer to - :type to_address: UInt160 + :type to_address: boa3.builtin.type.UInt160 :param amount: the amount of NEO to transfer :type amount: int :param data: whatever data is pertinent to the onNEP17Payment method @@ -143,7 +142,7 @@ def unclaimed_gas(cls, account: UInt160, end: int) -> int: 100000000 :param account: the account to check - :type account: UInt160 + :type account: boa3.builtin.type.UInt160 :param end: the block index used when calculating GAS :type end: int """ @@ -158,7 +157,7 @@ def register_candidate(cls, pubkey: ECPoint) -> bool: False :param pubkey: The public key of the account to be registered - :type pubkey: ECPoint + :type pubkey: boa3.builtin.type.ECPoint :return: whether the registration was a success or not :rtype: bool """ @@ -173,7 +172,7 @@ def unregister_candidate(cls, pubkey: ECPoint) -> bool: False :param pubkey: The public key of the account to be unregistered - :type pubkey: ECPoint + :type pubkey: boa3.builtin.type.ECPoint :return: whether the unregistration was a success or not :rtype: bool """ @@ -188,9 +187,9 @@ def vote(cls, account: UInt160, vote_to: ECPoint) -> bool: False :param account: the account that is voting - :type account: UInt160 + :type account: boa3.builtin.type.UInt160 :param vote_to: the public key of the one being voted - :type vote_to: ECPoint + :type vote_to: boa3.builtin.type.ECPoint """ pass @@ -203,7 +202,7 @@ def get_all_candidates(cls) -> Iterator: [] :return: all registered candidates - :rtype: Iterator + :rtype: boa3.builtin.interop.iterator.Iterator """ pass @@ -216,7 +215,7 @@ def un_vote(cls, account: UInt160) -> bool: False :param account: the account that is removing the vote - :type account: UInt160 + :type account: boa3.builtin.type.UInt160 """ pass @@ -229,7 +228,7 @@ def get_candidates(cls) -> list[tuple[ECPoint, int]]: [] :return: all registered candidates - :rtype: list[tuple[ECPoint, int]] + :rtype: list[tuple[boa3.builtin.type.ECPoint, int]] """ pass @@ -258,7 +257,7 @@ def get_committee(cls) -> list[ECPoint]: [ b'\\x02|\\x84\\xb0V\\xc2j{$XG\\x1em\\xcfgR\\xed\\xd9k\\x96\\x88}x34\\xe3Q\\xdd\\xfe\\x13\\xc4\\xbc\\xa2' ] :return: all committee members - :rtype: list[ECPoint] + :rtype: list[boa3.builtin.type.ECPoint] """ pass @@ -271,7 +270,7 @@ def get_next_block_validators(cls) -> list[ECPoint]: [ b'\\x02|\\x84\\xb0V\\xc2j{$XG\\x1em\\xcfgR\\xed\\xd9k\\x96\\x88}x34\\xe3Q\\xdd\\xfe\\x13\\xc4\\xbc\\xa2' ] :return: the public keys of the validators - :rtype: list[ECPoint] + :rtype: list[boa3.builtin.type.ECPoint] """ pass @@ -288,7 +287,7 @@ def get_account_state(cls, account: UInt160) -> NeoAccountState: } :param account: the specified account - :type account: UInt160 + :type account: boa3.builtin.type.UInt160 :return: the state of the account :rtype: NeoAccountState """ diff --git a/boa3/builtin/nativecontract/oracle.py b/boa3/builtin/nativecontract/oracle.py index 2682e5668..28bc43d56 100644 --- a/boa3/builtin/nativecontract/oracle.py +++ b/boa3/builtin/nativecontract/oracle.py @@ -4,12 +4,11 @@ from typing import Any -from deprecation import deprecated - from boa3.builtin.type import UInt160 +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.contracts` instead') class Oracle: """ Neo Oracle Service is an out-of-chain data access service built into Neo N3. It allows users to request the external diff --git a/boa3/builtin/nativecontract/policy.py b/boa3/builtin/nativecontract/policy.py index 9fe34a322..7e9d550dd 100644 --- a/boa3/builtin/nativecontract/policy.py +++ b/boa3/builtin/nativecontract/policy.py @@ -2,12 +2,11 @@ 'Policy', ] -from deprecation import deprecated - from boa3.builtin.type import UInt160 +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.contracts` instead') class Policy: """ A class used to represent the Policy native contract. @@ -67,7 +66,7 @@ def is_blocked(cls, account: UInt160) -> bool: False :param account: the account to be checked - :type account: UInt160 + :type account: boa3.builtin.type.UInt160 :return: whether the account is blocked or not :rtype: bool diff --git a/boa3/builtin/nativecontract/rolemanagement.py b/boa3/builtin/nativecontract/rolemanagement.py index a64e824d8..d32e2458c 100644 --- a/boa3/builtin/nativecontract/rolemanagement.py +++ b/boa3/builtin/nativecontract/rolemanagement.py @@ -3,13 +3,12 @@ 'Role', ] -from deprecation import deprecated - from boa3.builtin.interop.role.roletype import Role from boa3.builtin.type import ECPoint, UInt160 +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.contracts` instead') class RoleManagement: """ A class used to represent the RoleManagement native contract. @@ -29,11 +28,11 @@ def get_designated_by_role(cls, role: Role, index: int) -> ECPoint: [] :param role: the type of the role - :type role: Role + :type role: boa3.builtin.interop.role.roletype.Role :param index: the index of the block to be queried :type index: int :return: the public keys of the nodes - :rtype: ECPoint + :rtype: boa3.builtin.type.ECPoint """ pass diff --git a/boa3/builtin/nativecontract/stdlib.py b/boa3/builtin/nativecontract/stdlib.py index ee90b7adf..95835f3ea 100644 --- a/boa3/builtin/nativecontract/stdlib.py +++ b/boa3/builtin/nativecontract/stdlib.py @@ -4,12 +4,11 @@ from typing import Any -from deprecation import deprecated - from boa3.builtin.type import UInt160 +from boa3.internal.deprecation import deprecated -@deprecated(details='This module is deprecated. Use boa3.sc.contracts instead') +@deprecated(details='This module is deprecated. Use :mod:`boa3.sc.contracts` instead') class StdLib: """ A class used to represent StdLib native contract. diff --git a/boa3/builtin/type/__init__.py b/boa3/builtin/type/__init__.py index 63f1d0e64..36028ff1e 100644 --- a/boa3/builtin/type/__init__.py +++ b/boa3/builtin/type/__init__.py @@ -13,10 +13,10 @@ 'TransactionId', ] -from deprecation import deprecated +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 Event: """ Describes an action that happened in the blockchain. diff --git a/boa3/builtin/type/helper.py b/boa3/builtin/type/helper.py index 7cdcf8169..d7db878f8 100644 --- a/boa3/builtin/type/helper.py +++ b/boa3/builtin/type/helper.py @@ -5,10 +5,10 @@ 'to_str', ] -from deprecation import deprecated +from boa3.internal.deprecation import deprecated -@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_bytes(value: str | int) -> bytes: """ Converts a str or integer value to an array of bytes @@ -22,7 +22,7 @@ def to_bytes(value: str | int) -> 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_str(value: bytes) -> str: """ Converts a bytes value to a string. @@ -33,7 +33,7 @@ def to_str(value: bytes) -> str: 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_int(value: bytes) -> int: """ Converts a bytes value to the integer it represents. @@ -44,7 +44,7 @@ def to_int(value: bytes) -> int: 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_bool(value: bytes) -> bool: """ Return a bytes value to the boolean it represents. diff --git a/boa3/internal/deprecation.py b/boa3/internal/deprecation.py new file mode 100644 index 000000000..c246e0b3b --- /dev/null +++ b/boa3/internal/deprecation.py @@ -0,0 +1,28 @@ +def deprecated(deprecated_in=None, removed_in=None, current_version=None, details=""): + if current_version is None: + import boa3 + current_version = boa3.__version__ + + check_module = deprecated_in is None + details = f'\n{details}'.replace('\n', '\n' + ' ' * 3) + + def wrapper(*args, **kwargs): + deprecated_version = deprecated_in + if check_module and len(args) > 0: + import inspect + import os.path + + if f'boa3{os.path.sep}builtin' in inspect.getfile(args[0]): + import boa3 + deprecated_version = boa3.__boa3_builtin_deprecate_version__ + + from deprecation import deprecated as deprecated_ + wrap = deprecated_( + deprecated_in=deprecated_version, + removed_in=removed_in, + current_version=current_version, + details=details + ) + return wrap(*args, **kwargs) + + return wrapper diff --git a/boa3/sc/contracts/contractmanagement.py b/boa3/sc/contracts/contractmanagement.py index a59497889..4d68e575c 100644 --- a/boa3/sc/contracts/contractmanagement.py +++ b/boa3/sc/contracts/contractmanagement.py @@ -59,7 +59,7 @@ def get_contract(cls, script_hash: UInt160) -> Contract | None: :param script_hash: a smart contract hash :type script_hash: boa3.sc.types.UInt160 :return: a contract - :rtype: Contract + :rtype: boa3.sc.type.Contract :raise Exception: raised if hash length isn't 20 bytes. """ @@ -83,7 +83,7 @@ def has_method(cls, hash: UInt160, method: str, parameter_count: int) -> bool: False :param hash: The hash of the deployed contract - :type hash: UInt160 + :type hash: boa3.sc.types.UInt160 :param method: The name of the method :type method: str :param parameter_count: The number of parameters @@ -126,7 +126,7 @@ def deploy(cls, nef_file: bytes, manifest: bytes, data: Any = None) -> Contract: :type data: Any :return: the contract that was created - :rtype: Contract + :rtype: boa3.sc.type.Contract :raise Exception: raised if the nef or the manifest are not a valid smart contract. """ diff --git a/boa3/sc/contracts/cryptolib.py b/boa3/sc/contracts/cryptolib.py index f623b7250..3684b0408 100644 --- a/boa3/sc/contracts/cryptolib.py +++ b/boa3/sc/contracts/cryptolib.py @@ -97,11 +97,11 @@ def verify_with_ecdsa(cls, message: bytes, pubkey: ECPoint, signature: bytes, cu :param message: the encrypted message :type message: bytes :param pubkey: the public key that might have created the item - :type pubkey: ECPoint + :type pubkey: boa3.sc.types.ECPoint :param signature: the signature of the item :type signature: bytes :param curve: the curve that will be used by the ecdsa - :type curve: NamedCurveHash + :type curve: boa3.sc.type.NamedCurveHash :return: a boolean value that represents whether the signature is valid :rtype: bool """ diff --git a/boa3/sc/contracts/gastoken.py b/boa3/sc/contracts/gastoken.py index f5daff2fe..fdd5ec4d5 100644 --- a/boa3/sc/contracts/gastoken.py +++ b/boa3/sc/contracts/gastoken.py @@ -104,7 +104,7 @@ def transfer(cls, from_address: UInt160, to_address: UInt160, amount: int, data: :param from_address: the address to transfer from :type from_address: boa3.sc.types.UInt160 :param to_address: the address to transfer to - :type to_address: UInt160 + :type to_address: boa3.sc.types.UInt160 :param amount: the amount of GAS to transfer :type amount: int :param data: whatever data is pertinent to the onNEP17Payment method diff --git a/boa3/sc/contracts/ledgercontract.py b/boa3/sc/contracts/ledgercontract.py index 53f8318fd..1be31ee1c 100644 --- a/boa3/sc/contracts/ledgercontract.py +++ b/boa3/sc/contracts/ledgercontract.py @@ -55,7 +55,7 @@ def get_block(cls, 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.sc.types.UInt256 :return: the desired block, if exists. None otherwise :rtype: boa3.sc.types.Block or None """ @@ -89,7 +89,7 @@ def get_current_hash(cls) -> UInt256: b'\\x3e\\x65\\xe5\\x4d\\x75\\x5a\\x94\\x90\\xd6\\x98\\x3a\\x77\\xe4\\x82\\xaf\\x7a\\x38\\xc9\\x8c\\x1a\\xc6\\xd9\\xda\\x48\\xbd\\x7c\\x22\\xb3\\x2a\\x9e\\x34\\xea' :return: the hash of the current block - :rtype: UInt256 + :rtype: boa3.sc.types.UInt256 """ pass @@ -114,7 +114,7 @@ def get_transaction(cls, hash_: UInt256) -> Transaction | None: None :param hash_: hash identifier of the transaction - :type hash_: UInt256 + :type hash_: boa3.sc.types.UInt256 :return: the Transaction, if exists. None otherwise """ pass @@ -155,7 +155,7 @@ def get_transaction_from_block(cls, block_hash_or_height: UInt256 | int, tx_inde None :param block_hash_or_height: a block identifier - :type block_hash_or_height: UInt256 or int + :type block_hash_or_height: boa3.sc.types.UInt256 or int :param tx_index: the transaction identifier in the block :type tx_index: int :return: the Transaction, if exists. None otherwise @@ -177,7 +177,7 @@ def get_transaction_height(cls, hash_: UInt256) -> int: -1 :param hash_: hash identifier of the transaction - :type hash_: UInt256 + :type hash_: boa3.sc.types.UInt256 :return: height of the transaction """ pass @@ -199,7 +199,7 @@ def get_transaction_signers(cls, hash_: UInt256) -> list[Signer]: ] :param hash_: hash identifier of the transaction - :type hash_: UInt256 + :type hash_: boa3.sc.types.UInt256 :return: VM state of the transaction """ pass @@ -213,7 +213,7 @@ def get_transaction_vm_state(cls, hash_: UInt256) -> VMState: VMState.HALT :param hash_: hash identifier of the transaction - :type hash_: UInt256 + :type hash_: boa3.sc.types.UInt256 :return: VM state of the transaction """ pass diff --git a/boa3/sc/contracts/neotoken.py b/boa3/sc/contracts/neotoken.py index fbc8012d2..3bd82cfeb 100644 --- a/boa3/sc/contracts/neotoken.py +++ b/boa3/sc/contracts/neotoken.py @@ -103,7 +103,7 @@ def transfer(cls, from_address: UInt160, to_address: UInt160, amount: int, data: :param from_address: the address to transfer from :type from_address: boa3.sc.types.UInt160 :param to_address: the address to transfer to - :type to_address: UInt160 + :type to_address: boa3.sc.types.UInt160 :param amount: the amount of NEO to transfer :type amount: int :param data: whatever data is pertinent to the onNEP17Payment method @@ -140,7 +140,7 @@ def unclaimed_gas(cls, account: UInt160, end: int) -> int: 100000000 :param account: the account to check - :type account: UInt160 + :type account: boa3.sc.types.UInt160 :param end: the block index used when calculating GAS :type end: int """ @@ -155,7 +155,7 @@ def register_candidate(cls, pubkey: ECPoint) -> bool: False :param pubkey: The public key of the account to be registered - :type pubkey: ECPoint + :type pubkey: boa3.sc.types.ECPoint :return: whether the registration was a success or not :rtype: bool """ @@ -170,7 +170,7 @@ def unregister_candidate(cls, pubkey: ECPoint) -> bool: False :param pubkey: The public key of the account to be unregistered - :type pubkey: ECPoint + :type pubkey: boa3.sc.types.ECPoint :return: whether the unregistration was a success or not :rtype: bool """ @@ -187,7 +187,7 @@ def vote(cls, account: UInt160, vote_to: ECPoint) -> bool: :param account: the account that is voting :type account: boa3.sc.types.UInt160 :param vote_to: the public key of the one being voted - :type vote_to: ECPoint + :type vote_to: boa3.sc.types.ECPoint """ pass @@ -226,7 +226,7 @@ def get_candidates(cls) -> list[tuple[ECPoint, int]]: [] :return: all registered candidates - :rtype: list[tuple[ECPoint, int]] + :rtype: list[tuple[boa3.sc.types.ECPoint, int]] """ pass @@ -255,7 +255,7 @@ def get_committee(cls) -> list[ECPoint]: [ b'\\x02|\\x84\\xb0V\\xc2j{$XG\\x1em\\xcfgR\\xed\\xd9k\\x96\\x88}x34\\xe3Q\\xdd\\xfe\\x13\\xc4\\xbc\\xa2' ] :return: all committee members - :rtype: list[ECPoint] + :rtype: list[boa3.sc.types.ECPoint] """ pass @@ -268,7 +268,7 @@ def get_committee_address(cls) -> UInt160: UInt160(0x9273d3c792bce5eab4daac1c3ffdc1e83c4237f7) :return: the address of the committee - :rtype: UInt160 + :rtype: boa3.sc.types.UInt160 """ pass @@ -294,7 +294,7 @@ def get_next_block_validators(cls) -> list[ECPoint]: [ b'\\x02|\\x84\\xb0V\\xc2j{$XG\\x1em\\xcfgR\\xed\\xd9k\\x96\\x88}x34\\xe3Q\\xdd\\xfe\\x13\\xc4\\xbc\\xa2' ] :return: the public keys of the validators - :rtype: list[ECPoint] + :rtype: list[boa3.sc.types.ECPoint] """ pass diff --git a/boa3/sc/contracts/policycontract.py b/boa3/sc/contracts/policycontract.py index 92ad893f4..3732d7dc1 100644 --- a/boa3/sc/contracts/policycontract.py +++ b/boa3/sc/contracts/policycontract.py @@ -78,7 +78,7 @@ def is_blocked(cls, account: UInt160) -> bool: False :param account: the account to be checked - :type account: UInt160 + :type account: boa3.sc.types.UInt160 :return: whether the account is blocked or not :rtype: bool diff --git a/boa3/sc/contracts/rolemanagement.py b/boa3/sc/contracts/rolemanagement.py index b8945c1ca..6ec1f33ea 100644 --- a/boa3/sc/contracts/rolemanagement.py +++ b/boa3/sc/contracts/rolemanagement.py @@ -24,11 +24,11 @@ def get_designated_by_role(cls, role: Role, index: int) -> ECPoint: [] :param role: the type of the role - :type role: Role + :type role: boa3.sc.type.Role :param index: the index of the block to be queried :type index: int :return: the public keys of the nodes - :rtype: ECPoint + :rtype: boa3.sc.types.ECPoint """ pass diff --git a/boa3/sc/runtime/__init__.py b/boa3/sc/runtime/__init__.py index b6472ef04..4e815b99b 100644 --- a/boa3/sc/runtime/__init__.py +++ b/boa3/sc/runtime/__init__.py @@ -37,7 +37,7 @@ def check_witness(hash_or_pubkey: UInt160 | ECPoint) -> bool: False :param hash_or_pubkey: script hash or public key to validate - :type hash_or_pubkey: UInt160 or ECPoint + :type hash_or_pubkey: boa3.sc.types.UInt160 or boa3.sc.types.ECPoint :return: a boolean value that represents whether the script hash was verified :rtype: bool """ @@ -85,7 +85,7 @@ def get_trigger() -> TriggerType: TriggerType.APPLICATION :return: a value that represents the contract trigger type - :rtype: TriggerType + :rtype: boa3.sc.types.TriggerType """ pass @@ -116,7 +116,7 @@ def get_notifications(script_hash: UInt160 = UInt160()) -> list[Notification]: :param script_hash: must have 20 bytes, but if it's all zero 0000...0000 it refers to all existing notifications (like a * wildcard) - :type script_hash: UInt160 + :type script_hash: boa3.sc.types.UInt160 :return: It will return an array of all matched notifications :rtype: list[Notification] """ diff --git a/boa3/sc/storage/__init__.py b/boa3/sc/storage/__init__.py index ae19a7ccf..37fd809a8 100644 --- a/boa3/sc/storage/__init__.py +++ b/boa3/sc/storage/__init__.py @@ -378,7 +378,7 @@ def get_uint160(key: bytes, context: StorageContext = get_context()) -> UInt160: :param context: storage context to be used :type context: StorageContext :return: the value corresponding to given key for current storage context - :rtype: UInt160 + :rtype: boa3.sc.types.UInt160 """ pass @@ -399,7 +399,7 @@ def try_get_uint160(key: bytes, context: StorageContext = get_context()) -> tupl :param context: storage context to be used :type context: StorageContext :return: the value corresponding to given key for current storage context and whether it was actually stored - :rtype: tuple[UInt160, bool] + :rtype: tuple[boa3.sc.types.UInt160, bool] """ pass @@ -421,7 +421,7 @@ def get_uint256(key: bytes, context: StorageContext = get_context()) -> UInt256: :param context: storage context to be used :type context: StorageContext :return: the value corresponding to given key for current storage context - :rtype: UInt256 + :rtype: boa3.sc.types.UInt256 """ pass @@ -442,7 +442,7 @@ def try_get_uint256(key: bytes, context: StorageContext = get_context()) -> tupl :param context: storage context to be used :type context: StorageContext :return: the value corresponding to given key for current storage context and whether it was actually stored - :rtype: tuple[UInt256, bool] + :rtype: tuple[boa3.sc.types.UInt256, bool] """ pass @@ -464,7 +464,7 @@ def get_ecpoint(key: bytes, context: StorageContext = get_context()) -> ECPoint: :param context: storage context to be used :type context: StorageContext :return: the value corresponding to given key for current storage context - :rtype: ECPoint + :rtype: boa3.sc.types.ECPoint """ pass @@ -485,7 +485,7 @@ def try_get_ecpoint(key: bytes, context: StorageContext = get_context()) -> tupl :param context: storage context to be used :type context: StorageContext :return: the value corresponding to given key for current storage context and whether it was actually stored - :rtype: tuple[ECPoint, bool] + :rtype: tuple[boa3.sc.types.ECPoint, bool] """ pass @@ -640,7 +640,7 @@ def put_uint160(key: bytes, value: UInt160, context: StorageContext = get_contex :param key: the identifier in the store for the new value :type key: bytes :param value: value to be stored - :type value: UInt160 + :type value: boa3.sc.types.UInt160 :param context: storage context to be used :type context: StorageContext """ @@ -658,7 +658,7 @@ def put_uint256(key: bytes, value: UInt256, context: StorageContext = get_contex :param key: the identifier in the store for the new value :type key: bytes :param value: value to be stored - :type value: UInt256 + :type value: boa3.sc.types.UInt256 :param context: storage context to be used :type context: StorageContext """ @@ -676,7 +676,7 @@ def put_ecpoint(key: bytes, value: ECPoint, context: StorageContext = get_contex :param key: the identifier in the store for the new value :type key: bytes :param value: value to be stored - :type value: ECPoint + :type value: boa3.sc.types.ECPoint :param context: storage context to be used :type context: StorageContext """ @@ -722,7 +722,7 @@ def find(prefix: bytes, :param context: storage context to be used :type context: StorageContext :param options: the options of the search - :type options: FindOptions + :type options: boa3.sc.types.FindOptions :return: an iterator with the search results :rtype: Iterator """ diff --git a/boa3/sc/types/__init__.py b/boa3/sc/types/__init__.py index 6255e246c..6e2bcf97c 100644 --- a/boa3/sc/types/__init__.py +++ b/boa3/sc/types/__init__.py @@ -186,13 +186,13 @@ class Block: about Blocks. :ivar hash: a unique identifier based on the unsigned data portion of the object - :vartype hash: UInt256 + :vartype hash: boa3.sc.types.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.sc.types.UInt256 :ivar merkle_root: the merkle root of the transactions - :vartype merkle_root: UInt256 + :vartype merkle_root: boa3.sc.types.UInt256 :ivar timestamp: UTC timestamp of the block in milliseconds :vartype timestamp: int :ivar nonce: a random number used once in the cryptography @@ -200,7 +200,7 @@ class Block: :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.sc.types.UInt160 :ivar transaction_count: the number of transactions on this block :vartype transaction_count: int """ @@ -229,7 +229,7 @@ class Contract: :ivar update_counter: the number of times the contract was updated :vartype update_counter: int :ivar hash: the hash of the contract - :vartype hash: UInt160 + :vartype hash: boa3.sc.types.UInt160 :ivar nef: the serialized Neo Executable Format (NEF) object holding of the smart contract code and compiler information :vartype nef: bytes @@ -323,9 +323,9 @@ class ContractPermissionDescriptor: Indicates which contracts are authorized to be called. :ivar hash: The hash of the contract. - :vartype hash: UInt160 or None + :vartype hash: boa3.sc.types.UInt160 or None :ivar group: The group of the contracts. - :vartype group: ECPoint or None + :vartype group: boa3.sc.types.ECPoint or None """ def __init__(self): @@ -344,7 +344,7 @@ class ContractGroup: the contract is indeed included in the group. :ivar pubkey: The public key of the group. - :vartype pubkey: ECPoint + :vartype pubkey: boa3.sc.types.ECPoint :ivar signature: The signature of the contract hash which can be verified by `pubkey`. :vartype signature: bytes """ @@ -456,13 +456,13 @@ class Signer: about Signers. :ivar account: - :vartype account: UInt160 + :vartype account: boa3.sc.types.UInt160 :ivar scopes: :vartype scopes: WitnessScope :ivar allowed_contracts: - :vartype allowed_contracts: list[UInt160] + :vartype allowed_contracts: list[boa3.sc.types.UInt160] :ivar allowed_groups: - :vartype allowed_groups: list[UInt160] + :vartype allowed_groups: list[boa3.sc.types.UInt160] :ivar rules: :vartype rules: list[WitnessRule] """ @@ -516,13 +516,13 @@ class Transaction: Transactions. :ivar hash: a unique identifier based on the unsigned data portion of the object - :vartype hash: UInt256 + :vartype hash: boa3.sc.types.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.sc.types.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 @@ -555,7 +555,7 @@ class Notification: Represents a notification. :ivar script_hash: the script hash of the notification sender - :vartype script_hash: UInt160 + :vartype script_hash: boa3.sc.types.UInt160 :ivar event_name: the notification's name :vartype event_name: str :ivar state: a tuple value storing all the notification contents. @@ -577,7 +577,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.sc.types.ECPoint """ def __init__(self): diff --git a/boa3/sc/utils/__init__.py b/boa3/sc/utils/__init__.py index cd5fae6f2..5657404c3 100644 --- a/boa3/sc/utils/__init__.py +++ b/boa3/sc/utils/__init__.py @@ -26,7 +26,7 @@ from boa3.sc.types import Event, ECPoint, UInt160, CallFlags from boa3.sc.utils.iterator import Iterator -env: str +env: str = 'compiler' """ Gets the compiled environment. This allows specific environment validations to be easily included in the smart contract logic without the need to rewrite anything before compiling (i.e. changes in smart contracts hashes between testnet and @@ -188,13 +188,13 @@ def call_contract(script_hash: UInt160, method: str, args: Sequence = (), call_f 100 :param script_hash: the target smart contract's script hash - :type script_hash: UInt160 + :type script_hash: boa3.sc.types.UInt160 :param method: the name of the method to be executed :type method: str :param args: the specified method's arguments :type args: Sequence[Any] :param call_flags: the CallFlags to be used to call the contract - :type call_flags: CallFlags + :type call_flags: boa3.sc.types.CallFlags :return: the result of the specified method :rtype: Any @@ -239,7 +239,7 @@ def check_sig(pub_key: ECPoint, signature: bytes) -> bool: False :param pub_key: the public key of the account - :type pub_key: ECPoint + :type pub_key: boa3.sc.types.ECPoint :param signature: the signature of the current script container :type signature: bytes :return: whether the signature is valid or not @@ -258,7 +258,7 @@ def check_multisig(pubkeys: list[ECPoint], signatures: list[bytes]) -> bool: False :param pubkeys: a list of public keys - :type pubkeys: list[ECPoint] + :type pubkeys: list[boa3.sc.types.ECPoint] :param signatures: a list of signatures :type signatures: list[bytes] :return: a boolean value that represents whether the signatures were validated @@ -275,10 +275,10 @@ def create_standard_account(pub_key: ECPoint) -> UInt160: b'\\r\\xa9g\\xa4\\x00C+\\xf2\\x7f\\x8e\\x8e\\xb4o\\xe8\\xace\\x9e\\xcc\\xde\\x04' :param pub_key: the given public key - :type pub_key: ECPoint + :type pub_key: boa3.sc.types.ECPoint :return: the corresponding script hash of the public key - :rtype: UInt160 + :rtype: boa3.sc.types.UInt160 """ pass @@ -293,10 +293,10 @@ def create_multisig_account(m: int, pub_keys: list[ECPoint]) -> UInt160: :param m: the minimum number of correct signatures need to be provided in order for the verification to pass. :type m: int :param pub_keys: the public keys of the account - :type pub_keys: list[ECPoint] + :type pub_keys: list[boa3.sc.types.ECPoint] :return: the hash of the corresponding account - :rtype: UInt160 + :rtype: boa3.sc.types.UInt160 """ pass diff --git a/boa3_test/tests/boatestcase.py b/boa3_test/tests/boatestcase.py index fe802d74c..67f09bc97 100644 --- a/boa3_test/tests/boatestcase.py +++ b/boa3_test/tests/boatestcase.py @@ -299,7 +299,6 @@ async def deploy( manifest_path = (pathlib.Path(frame.filename) .parent .joinpath(path_to_nef) - .with_suffix("") .with_suffix(".manifest.json") ) diff --git a/docs/source/auto-package/boa3/boa3.rst b/docs/source/auto-package/boa3/boa3.rst deleted file mode 100644 index ecc161a84..000000000 --- a/docs/source/auto-package/boa3/boa3.rst +++ /dev/null @@ -1,7 +0,0 @@ -boa3 package -============ - -.. toctree:: - :caption: Contents: - - builtin/boa3-builtins diff --git a/docs/source/auto-package/boa3/sc/boa3-sc-math.rst b/docs/source/auto-package/boa3/sc/boa3-sc-math.rst new file mode 100644 index 000000000..700393e1a --- /dev/null +++ b/docs/source/auto-package/boa3/sc/boa3-sc-math.rst @@ -0,0 +1,6 @@ +math +==== + +.. automodule:: boa3.sc.math + :autosummary: + :autosummary-nosignatures: diff --git a/docs/source/auto-package/boa3/sc/boa3-sc.rst b/docs/source/auto-package/boa3/sc/boa3-sc.rst new file mode 100644 index 000000000..2da46c789 --- /dev/null +++ b/docs/source/auto-package/boa3/sc/boa3-sc.rst @@ -0,0 +1,17 @@ +boa3.sc package +=============== + +.. automodule:: boa3.sc + :no-undoc-members: + :autosummary: + :autosummary-nosignatures: + +.. toctree:: + + compile-time/boa3-sc-compile-time + contracts/boa3-sc-contracts + boa3-sc-math + runtime/boa3-sc-runtime + storage/boa3-sc-storage + types/boa3-sc-types + utils/boa3-sc-utils diff --git a/docs/source/auto-package/boa3/sc/compile-time/boa3-sc-compile-time.rst b/docs/source/auto-package/boa3/sc/compile-time/boa3-sc-compile-time.rst new file mode 100644 index 000000000..b372208e7 --- /dev/null +++ b/docs/source/auto-package/boa3/sc/compile-time/boa3-sc-compile-time.rst @@ -0,0 +1,7 @@ +compiletime +=========== + +.. automodule:: boa3.sc.compiletime + :no-undoc-members: + :autosummary: + :autosummary-nosignatures: diff --git a/docs/source/auto-package/boa3/sc/contracts/boa3-sc-contracts.rst b/docs/source/auto-package/boa3/sc/contracts/boa3-sc-contracts.rst new file mode 100644 index 000000000..8273476ec --- /dev/null +++ b/docs/source/auto-package/boa3/sc/contracts/boa3-sc-contracts.rst @@ -0,0 +1,7 @@ +contracts +========= + +.. automodule:: boa3.sc.contracts + :no-undoc-members: + :autosummary: + :autosummary-nosignatures: diff --git a/docs/source/auto-package/boa3/sc/runtime/boa3-sc-runtime.rst b/docs/source/auto-package/boa3/sc/runtime/boa3-sc-runtime.rst new file mode 100644 index 000000000..3687cf371 --- /dev/null +++ b/docs/source/auto-package/boa3/sc/runtime/boa3-sc-runtime.rst @@ -0,0 +1,7 @@ +runtime +======= + +.. automodule:: boa3.sc.runtime + :no-undoc-members: + :autosummary: + :autosummary-nosignatures: diff --git a/docs/source/auto-package/boa3/sc/storage/boa3-sc-storage.rst b/docs/source/auto-package/boa3/sc/storage/boa3-sc-storage.rst new file mode 100644 index 000000000..1f40ddb52 --- /dev/null +++ b/docs/source/auto-package/boa3/sc/storage/boa3-sc-storage.rst @@ -0,0 +1,7 @@ +storage +======= + +.. automodule:: boa3.sc.storage + :no-undoc-members: + :autosummary: + :autosummary-nosignatures: diff --git a/docs/source/auto-package/boa3/sc/types/boa3-sc-types.rst b/docs/source/auto-package/boa3/sc/types/boa3-sc-types.rst new file mode 100644 index 000000000..9b0134c7f --- /dev/null +++ b/docs/source/auto-package/boa3/sc/types/boa3-sc-types.rst @@ -0,0 +1,7 @@ +types +===== + +.. automodule:: boa3.sc.types + :no-undoc-members: + :autosummary: + :autosummary-nosignatures: diff --git a/docs/source/auto-package/boa3/sc/utils/boa3-sc-utils.rst b/docs/source/auto-package/boa3/sc/utils/boa3-sc-utils.rst new file mode 100644 index 000000000..971cb248c --- /dev/null +++ b/docs/source/auto-package/boa3/sc/utils/boa3-sc-utils.rst @@ -0,0 +1,7 @@ +utils +===== + +.. automodule:: boa3.sc.utils + :no-undoc-members: + :autosummary: + :autosummary-nosignatures: diff --git a/docs/source/auto-package/package-reference.rst b/docs/source/auto-package/package-reference.rst index 77c09946a..82ed4e4ff 100644 --- a/docs/source/auto-package/package-reference.rst +++ b/docs/source/auto-package/package-reference.rst @@ -2,6 +2,8 @@ Package Reference ================= .. toctree:: - :caption: Contents: + :caption: boa3 package: + + boa3/sc/boa3-sc + boa3/builtin/boa3-builtins - boa3/boa3 diff --git a/docs/source/conf.py b/docs/source/conf.py index f6fe96caa..f26ad67fd 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -34,9 +34,11 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.autosummary', 'sphinx.ext.intersphinx', 'sphinx.ext.ifconfig', 'sphinx.ext.githubpages', + 'autodocsumm', 'myst_parser' ] diff --git a/docs/source/getting-started.md b/docs/source/getting-started.md index f2e4f10d4..4a29a8bfd 100644 --- a/docs/source/getting-started.md +++ b/docs/source/getting-started.md @@ -11,30 +11,6 @@ there are some key differences that you should be aware of, here's the 4 most pr - if you want to call other smart contracts, you can only call public functions; - to interact with the Neo blockchain, you need to use a function, variable, or class inside the `boa3.builtin` package. -### Overview of Neo3-Boa features - -| Packages | Contains: | Important features | -|-----------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [boa3.builtin](auto-package/boa3/builtin/boa3-builtins) | all packages below, it also contains an env variable that lets you change the value of a variable when compiling the smart contract. | {data}`env ` | -| [boa3.builtin.compile_time](auto-package/boa3/builtin/compile-time/boa3-builtin-compile-time) | methods and classes that are needed when you are compiling your smart contract, as opposed to when it's being executed on the blockchain. | {func}`public `, {func}`metadata `, {func}`contract `, {func}`CreateNewEvent `, {class}`NeoMetadata ` | -| [boa3.builtin.contract](auto-package/boa3/builtin/contract/boa3-builtin-contract) | events and methods that might help when writing something specific about Neo blockchain | {func}`abort `, {data}`Nep17TransferEvent `, {data}`Nep11TransferEvent ` | -| [boa3.builtin.interop](auto-package/boa3/builtin/interop/boa3-builtin-interop) | other packages that have a lot of helpful interoperable services. Has some overlap with the native contracts. | {mod}`storage `, {mod}`runtime `, {mod}`contract `, {mod}`blockchain ` | -| [boa3.builtin.interop.blockchain](auto-package/boa3/builtin/interop/blockchain/boa3-builtin-interop-blockchain) | features to get information on the Neo blockchain. | {data}`current_hash `, {func}`get_contract `, {class}`Transaction ` | -| [boa3.builtin.interop.contract](auto-package/boa3/builtin/interop/contract/boa3-builtin-interop-contract) | features related to smart contracts. | {func}`call_contract `, {func}`update_contract `, {class}`Contract ` | -| [boa3.builtin.interop.crypto](auto-package/boa3/builtin/interop/crypto/boa3-builtin-interop-crypto) | features related to cryptography. | {func}`sha256 `, {func}`hash160 `, {func}`hash256 `, {func}`check_sig ` | -| [boa3.builtin.interop.iterator](auto-package/boa3/builtin/interop/iterator/boa3-builtin-interop-iterator) | the iterator class. | {class}`Iterator ` | -| [boa3.builtin.interop.json](auto-package/boa3/builtin/interop/json/boa3-builtin-interop-json) | methods to serialize and deserialize JSON. | {func}`json_serialize `, {func}`json_deserialize ` | -| [boa3.builtin.interop.oracle](auto-package/boa3/builtin/interop/oracle/boa3-builtin-interop-oracle) | features related with Neo Oracle, it is used to get information from outside the blockchain. | {class}`Oracle ` | -| [boa3.builtin.interop.policy](auto-package/boa3/builtin/interop/policy/boa3-builtin-interop-policy) | features related to policies that affect the entire Neo blockchain. | {func}`get_exec_fee_factor `, {func}`get_storage_price ` | -| [boa3.builtin.interop.role](auto-package/boa3/builtin/interop/role/boa3-builtin-interop-role) | methods to get information about the nodes on the blockchain. | {func}`get_designated_by_role ` | -| [boa3.builtin.interop.runtime](auto-package/boa3/builtin/interop/runtime/boa3-builtin-interop-runtime) | features to get information that can only be acquired when running the smart contract. | {func}`check_witness `, {func}`calling_script_hash `, {func}`executing_script_hash `, {func}`script_container `, {class}`Notification ` | -| [boa3.builtin.interop.stdlib](auto-package/boa3/builtin/interop/stdlib/boa3-builtin-interop-stdlib) | methods that convert one data to another or methods that can check and compare memory. | {func}`serialize `, {func}`deserialize ` | -| [boa3.builtin.interop.storage](auto-package/boa3/builtin/interop/storage/boa3-builtin-interop-storage) | features to store, get, or change values inside the blockchain. | {func}`get `, {func}`put `, {func}`find `, {class}`FindOptions ` | -| [boa3.builtin.nativecontract](auto-package/boa3/builtin/nativecontract/boa3-builtin-nativecontract) | classes that interface Neo's native contracts. | {class}`ContractManagement `, {class}`GAS `, {class}`NEO `, {class}`StdLib ` | -| [boa3.builtin.type](auto-package/boa3/builtin/type/boa3-builtin-type) | Neo types. | {class}`UInt160 `, {class}`UInt256 `, {class}`Event `, {class}`ECPoint ` | -| [boa3.builtin.vm](auto-package/boa3/builtin/vm/boa3-builtin-vm) | Opcodes used internally by the Neo VM, used to create scripts dynamically. | {class}`Opcode ` | -| [boa3.builtin.math](auto-package/boa3/builtin/boa3-builtin-math) | a small sample of functions similar to Python's math. | {func}`sqrt `, {func}`floor `, {func}`ceil ` | - ### Hello World Let's write a quick Hello World script that has a method that will save `"Hello World"` on the blockchain @@ -238,6 +214,8 @@ For an extensive collection of examples: - [Smart contract examples](../../boa3_test/examples) - [Features tests](../../boa3_test/test_sc) +For reference of boa3 smart contract package utilities, take a look at [Package Reference](https://dojo.coz.io/neo3/boa/auto-package/package-reference.html) from boa3 documentation + ## What's next - [Testing and debugging your smart contract](./testing-and-debugging.md) diff --git a/pyproject.toml b/pyproject.toml index 060ac759d..885a43523 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,9 +31,10 @@ dev = [ 'twine>=1.10.0', ] test = [ - 'boa-test-constructor==0.3.1', + 'boa-test-constructor>=0.3.1', ] docs = [ + 'autodocsumm>=0.2.12', 'myst-parser==1.0.0', 'Sphinx==5.0.0', 'sphinx-rtd-theme==1.2.1', @@ -54,7 +55,6 @@ exclude = ['boa3_test.tests.*_tests*'] include = [ 'boa3', 'boa3.*', 'boa3_test', - 'boa3_test.tests', 'boa3_test.tests.*', 'boa3_test.test_drive', 'boa3_test.test_drive.*' ]