revokeTrustlineSponsorship method

RevokeSponsorshipOperationBuilder revokeTrustlineSponsorship (
  1. String accountId,
  2. Asset asset
)

Implementation

RevokeSponsorshipOperationBuilder revokeTrustlineSponsorship(
    String accountId, Asset asset) {
  if (_ledgerKey != null || _signerKey != null) {
    throw new Exception("can not revoke multiple entries per builder");
  }
  checkNotNull(accountId, "accountId cannot be null");
  checkNotNull(asset, "asset cannot be null");

  _ledgerKey = XdrLedgerKey();
  _ledgerKey.discriminant = XdrLedgerEntryType.TRUSTLINE;

  XdrAccountID accId = XdrAccountID();
  accId.accountID = KeyPair.fromAccountId(accountId).xdrPublicKey;
  XdrLedgerKeyTrustLine lt = XdrLedgerKeyTrustLine();
  lt.accountID = accId;
  lt.asset = asset.toXdr();
  _ledgerKey.trustLine = lt;

  return this;
}