deserializeWithConsumedLength static method

(SuiIntentMessage, int) deserializeWithConsumedLength(
  1. List<int> bytes, {
  2. String? property,
})

Implementation

static (SuiIntentMessage, int) deserializeWithConsumedLength(
  List<int> bytes, {
  String? property,
}) {
  final intent = SuiIntent.deserialize(bytes);
  switch (intent.scope) {
    case SuiIntentScope.transactionData:
      final layout = LayoutConst.struct([
        SuiIntent.layout(property: "intent"),
        SuiTransactionData.layout(property: "message"),
      ], property: property);
      final decode = layout.deserialize(bytes);
      return (SuiIntentMessage.fromStruct(decode.value), decode.consumed);
    default:
      throw DartSuiPluginException(
        "Intent message does not supported.",
        details: {
          "scope": intent.scope.name,
          "version": intent.version.name,
          "application_id": intent.applicationId.name,
        },
      );
  }
}