contract

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.

Parameters
  • script_hash (UInt160) – the target smart contract’s script hash

  • method (str) – the name of the method to be executed

  • args (Sequence[Any]) – the specified method’s arguments

  • call_flags (CallFlags) – the CallFlags to be used to call the contract

Returns

the result of the specified method

Return type

Any

Raises

Exception – raised if there isn’t a valid CallFlags, the script hash is not a valid smart contract or the method was not found or the arguments aren’t valid to the specified method.

create_contract(nef_file: bytes, manifest: bytes, data: Optional[Any] = None) Contract

Creates a smart contract given the script and the manifest.

Parameters
  • nef_file (bytes) – the target smart contract’s compiled nef

  • manifest (bytes) – the manifest.json that describes how the script should behave

  • data (Any) – the parameters for the _deploy function

Returns

the contract that was created

Return type

Contract

Raises

Exception – raised if the nef or the manifest are not a valid smart contract.

update_contract(nef_file: bytes, manifest: bytes, data: Optional[Any] = None)

Updates the executing smart contract given the script and the manifest.

Parameters
  • nef_file (bytes) – the new smart contract’s compiled nef

  • manifest (bytes) – the new smart contract’s manifest

  • data (Any) – the parameters for the _deploy function

Raises

Exception – raised if the nef and the manifest are not a valid smart contract or the new contract is the same as the old one.

destroy_contract()

Destroy the executing smart contract.

get_minimum_deployment_fee() int

Gets the minimum fee of contract deployment.

Returns

the minimum fee of contract deployment

get_call_flags() CallFlags

Gets the CallFlags in the current context.

create_standard_account(pub_key: ECPoint) UInt160

Calculates the script hash from a public key.

Parameters

pub_key (ECPoint) – the given public key

Returns

the corresponding script hash of the public key

Return type

UInt160

create_multisig_account(m: int, pub_keys: List[ECPoint]) UInt160

Calculates corresponding multisig account script hash for the given public keys.

Parameters
  • m (int) – the minimum number of correct signatures need to be provided in order for the verification to pass.

  • pub_keys (List[ECPoint]) – the public keys of the account

Returns

the hash of the corresponding account

Return type

UInt160

NEO: UInt160

NEO’s token script hash.

GAS: UInt160

GAS’ token script hash.

Subpackages