fromXdr static method

Returns Operation object from an Operation XDR object xdrOp.

Implementation

static RevokeSponsorshipOperation? fromXdr(XdrRevokeSponsorshipOp op) {
  switch (op.discriminant) {
    case XdrRevokeSponsorshipType.REVOKE_SPONSORSHIP_LEDGER_ENTRY:
      XdrLedgerKey ledgerKey = op.ledgerKey!;
      return RevokeSponsorshipOperation(ledgerKey, null, null);
    case XdrRevokeSponsorshipType.REVOKE_SPONSORSHIP_SIGNER:
      String signerAccountId =
          KeyPair.fromXdrPublicKey(op.signer!.accountId.accountID).accountId;
      XdrSignerKey signerKey = op.signer!.signerKey;
      return RevokeSponsorshipOperation(null, signerAccountId, signerKey);
  }
}