app/services/token_management/insert_token_details.rb
def delete_old_addresses

      # Fetch token id
      # delete if any address present in token addresses table and client_wallet_addresses table

      token_id = @token_details.id
      ClientWalletAddress.where(client_id: @client_id, sub_environment: GlobalConstant::Base.sub_environment_name ).destroy_all
      token_addresses = TokenAddresses.where(token_id: token_id, kind: GlobalConstant::TokenAddresses.owner_address_kind).first

      if token_addresses.present? && token_addresses.known_address_id.present?
        SaasApi::WalletAddress::RemoveKnownAddress.new.perform({known_address_id: token_addresses.known_address_id, client_id: @client_id})
        token_addresses.destroy!
      end

      success

    end
# Delete old addresses which were present in wallet_addresses and token_addresses table
#
#
# * Author: Ankit
# * Date: 19/01/2019
# * Reviewed By:
#
# @return [Result::Base]
Delete old addresses which were present in wallet_addresses and token_addresses table
Author: Ankit
Date: 19/01/2019
Reviewed By.
Delete old addresses which were present in wallet_addresses and token_addresses table Author : Ankit Date : 19 / 01 / 2019 Reviewed By .
def delete_old_addresses
      token_id = @token_details.id
      ClientWalletAddress.where(client_id: @client_id, sub_environment: GlobalConstant::Base.sub_environment_name ).destroy_all
      token_addresses = TokenAddresses.where(token_id: token_id, kind: GlobalConstant::TokenAddresses.owner_address_kind).first
      if token_addresses.present? && token_addresses.known_address_id.present?
        SaasApi::WalletAddress::RemoveKnownAddress.new.perform({known_address_id: token_addresses.known_address_id, client_id: @client_id})
        token_addresses.destroy!
      end
      success
    end
def delete_old_addresses token_id = @token_details . id ClientWalletAddress . where ( client_id : @client_id , sub_environment : GlobalConstant :: Base . sub_environment_name ) . destroy_all token_addresses = TokenAddresses . where ( token_id : token_id , kind : GlobalConstant :: TokenAddresses . owner_address_kind ) . first if token_addresses . present? && token_addresses . known_address_id . present? SaasApi :: WalletAddress :: RemoveKnownAddress . new . perform ( { known_address_id : token_addresses . known_address_id , client_id : @client_id } ) token_addresses . destroy! end success end
Delete old addresses which were present in wallet_addresses and token_addresses table
 Author: Ankit
 Date: 19/01/2019
 Reviewed By:
Delete old addresses which were present in wallet_addresses and token_addresses table Author : Ankit Date : 19 / 01 / 2019 Reviewed By :
# Fetch token id # delete if any address present in token addresses table and client_wallet_addresses table
None
Result::Base