unpackInitData function

Future<(PublicKey?, Map<String, dynamic>)> unpackInitData({
  1. required String contractAbi,
  2. required String data,
})

Unpack data from contractAbi. Returns optional public key and json-encoded Map<String, Token> or throws error.

Implementation

Future<(PublicKey?, Map<String, dynamic>)> unpackInitData({
  required String contractAbi,
  required String data,
}) async {
  final result = await createLib().unpackInitData(
    contractAbi: contractAbi,
    data: data,
  );

  return (
    result[0] == null ? null : PublicKey(publicKey: result[0]!),
    jsonDecode(result[1]!) as Map<String, dynamic>,
  );
}