SmartContractResult class

Cross-shard / asynchronous execution output generated by the VM.

Every non-trivial transaction on MultiversX can produce one or more SmartContractResult entries: refunds, cross-shard move-balance results, asynchronous contract callbacks, and more. The data field follows the @<returnCode>@<returnData1>@<returnData2>... hex-encoded layout, which is decoded eagerly into returnCode / returnData by fromJson.

Call types map to MultiversX's VM execution:

  • 0 — direct SC call / refund
  • 1 — async call initiated from another contract
  • 2 — async callback landing back in the caller

Example

final tx = await provider.getTransaction(hash, withProcessStatus: true);
for (final scr in tx.smartContractResults ?? <SmartContractResult>[]) {
  if (scr.returnCode.isError) {
    print('SCR failed: ${scr.errorMessage ?? scr.returnCode.message}');
  } else {
    for (final part in scr.returnData) {
      print('Return part: 0x${_hex(part)}');
    }
  }
}

Constructors

SmartContractResult({required String hash, required int nonce, required String value, required Address sender, required Address receiver, required Uint8List data, required ReturnCode returnCode, required List<Uint8List> returnData, String? previousHash, String? originalHash, int? gasLimit, int? gasPrice, int callType = 0, String? errorMessage, TransactionLogs? logs, Map<String, dynamic> raw = const <String, dynamic>{}})
Creates a SmartContractResult.
const
SmartContractResult.fromJson(Map<String, dynamic> json)
Parses a smart-contract result from an API / Gateway payload.
factory
SmartContractResult.fromProxyJson(Map<String, dynamic> json)
Parses a smart-contract result from a Gateway/Proxy payload.
factory

Properties

callType int
VM call type (0 = direct, 1 = async, 2 = async callback).
final
data Uint8List
Raw data bytes (whatever the data field decoded to — empty if missing).
final
errorMessage String?
Network-provided error message, if any.
final
gasLimit int?
Gas allowance for this SCR (if present).
final
gasPrice int?
Gas price for this SCR (if present).
final
hash String
Result hash.
final
hashCode int
The hash code for this object.
no setterinherited
isAsyncCall bool
Whether this result is an async call (callType 1).
no setter
isAsyncCallback bool
Whether this result is an async callback (callType 2).
no setter
isFailure bool
Whether this result represents a failed execution.
no setter
isSuccess bool
Whether this result represents a successful execution.
no setter
logs TransactionLogs?
Logs emitted by this result, if present.
final
nonce int
Nonce used for this result.
final
originalHash String?
Hash of the original transaction that triggered the call graph.
final
previousHash String?
Hash of the previous transaction in the chain.
final
raw Map<String, dynamic>
Raw JSON payload for access to provider-specific fields.
final
receiver Address
Result receiver.
final
returnCode ReturnCode
Decoded return code (first @-segment of data).
final
returnData List<Uint8List>
Decoded return-data parts (subsequent @-segments, hex-decoded).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sender Address
Result sender.
final
value String
EGLD value moved (as string of atomic units).
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited