SuiIntentMessage.fromStruct constructor

SuiIntentMessage.fromStruct(
  1. Map<String, dynamic> json
)

Implementation

factory SuiIntentMessage.fromStruct(Map<String, dynamic> json) {
  final intent = SuiIntent.fromStruct(json.asMap("intent"));
  return switch (intent.scope) {
    SuiIntentScope.transactionData => SuiIntentMessage(
      intent: intent,
      message: SuiTransactionData.fromStruct(json.asMap("message")),
    ),
    _ =>
      throw DartSuiPluginException(
        "Intent message does not supported.",
        details: {
          "scope": intent.scope.name,
          "version": intent.version.name,
          "application_id": intent.applicationId.name,
        },
      ),
  };
}