NRE Reference
Here you can find a complete reference of the functions provided by the Nile Runtime Environment, and a reference of the Account methods.
NRE API
Functions provided within the NRE object.
call
call(address_or_alias, method, params=None, abi=None) → output
Call a view function in a smart contract.
get_or_deploy_account
get_or_deploy_account(signer, watch_mode=None) → account
Get or deploy an Account contract.
Arguments
-
signer
Alias representing the private key associated.
-
watch_mode
Either None, track or debug. Block the execution to query the status of the deployment transaction if needed.
Return values
-
account
An Account instance matching the signer.
get_accounts
get_accounts(predeployed=False) → accounts
Retrieve and manage deployed accounts.
Return values
-
accounts
A list of registered Accounts.
Account API
Public API of the Account abstraction.
send
async send(self, address_or_alias, method, calldata, nonce=None, max_fee=None) → transaction
Return a Transaction instance representing an invoke transaction.
Arguments
-
address_or_alias
Target contract identifier (alias needs to be registered in deployments).
-
method
Method to execute.
-
calldata
Arguments for the call.
-
nonce
Account nonce. Is automatically computed when is left as
None
. -
max_fee
The max fee you are willing to pay for the transaction execution.
This value will be usually left as
None
, because the returned transaction allows to estimate and update the fee later.
Return values
-
transaction
A Transaction instance.
declare
async declare(self, contract_name, nonce=None, max_fee=None, alias=None, overriding_path=None, nile_account=False) → transaction
Return a Transaction instance representing a declare transaction.
Arguments
-
contract_name
The name of the contract to declare (for artifacts resolution).
-
nonce
Account nonce. Is automatically computed when is left as
None
. -
max_fee
The max fee you are willing to pay for the transaction execution.
This value will be usually left as
None
, because the returned transaction allows to estimate and update the fee later. -
alias
The alias for registering the declared class_hash (DEPRECATED).
-
overriding_path
Path override for artifacts and abi resolution.
-
nile_account
Whether to use the OZ account artifact.
Return values
-
transaction
A Transaction instance.
deploy_contract
async deploy_contract(self, contract_name, salt, unique, calldata, nonce=None, max_fee=None, deployer_address=None, alias=None, overriding_path=None, abi=None) → transaction
Return a Transaction instance representing a deploy through UDC transaction. See the Universal Deployer Contract documentation.
Arguments
-
contract_name
The name of the contract to deploy (for artifacts resolution).
-
salt
andunique
UDC specific arguments for address generation.
-
calldata
Contract to deploy constructor arguments.
-
nonce
Account nonce. Is automatically computed when is left as
None
. -
max_fee
The max fee you are willing to pay for the transaction execution.
This value will be usually left as
None
, because the returned transaction allows to estimate and update the fee later. -
deployer_address
Specify a different deployer address.
Default to the UDC address.
-
alias
The alias for deployment registration.
-
overriding_path
Path override for artifacts and abi resolution.
-
abi
Override for the contract ABI (for deployment registration).
Return values
-
transaction
A Transaction instance.
Transaction API
Public API of the Transaction abstraction.
execute
async execute(self, watch_mode=None) → (tx_status, log_output)
Execute the transaction.
Arguments
-
watch_mode
Allow waiting for the transaction to be included in a block. Either
None
,track
ordebug
.track
to continue probing the network in case of pending transaction states.debug
to use locally available contracts to make error messages from rejected transactions more explicit (Impliestrack
).Default to
None
(non blocking).