getContractFields method

  1. @override
Future<(Map<String, dynamic>?, FullContractState?)> getContractFields({
  1. required Address address,
  2. required String contractAbi,
  3. FullContractState? cachedState,
})
override

Get contract fields of address and return (Map<String, dynamic>, state) or throw error. This method automatically loads state by calling getFullContractState if cachedState is null.

Implementation

@override
Future<(Map<String, dynamic>?, FullContractState?)> getContractFields({
  required Address address,
  required String contractAbi,
  FullContractState? cachedState,
}) async {
  if (_disposed) throw TransportCallAfterDisposeError();

  final state = cachedState ?? await getFullContractState(address);
  if (state == null) {
    return (null, null);
  }

  return (
    await unpackContractFields(
      contractAbi: contractAbi,
      boc: state.boc,
      allowPartial: true,
    ),
    state,
  );
}