Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address info #8

Open
wants to merge 2 commits into
base: qa
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions OpenSSL/ios/include/openssl/ecdsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,20 +288,21 @@ void ECDSA_METHOD_set_verify(ECDSA_METHOD *ecdsa_method,
const ECDSA_SIG *sig,
EC_KEY *eckey));

void ECDSA_METHOD_set_flags(ECDSA_METHOD *ecdsa_method, int flags);

/** Set the flags field in the ECDSA_METHOD
* \param ecdsa_method pointer to existing ECDSA_METHOD
* \param flags flags value to set
*/

void ECDSA_METHOD_set_name(ECDSA_METHOD *ecdsa_method, char *name);
void ECDSA_METHOD_set_flags(ECDSA_METHOD *ecdsa_method, int flags);

/** Set the name field in the ECDSA_METHOD
* \param ecdsa_method pointer to existing ECDSA_METHOD
* \param name name to set
*/

void ECDSA_METHOD_set_name(ECDSA_METHOD *ecdsa_method, char *name);


/* BEGIN ERROR CODES */
/*
* The following lines are auto generated by the script mkerr.pl. Any changes
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// AddressInformationFactory.swift
// transactId-library-ios
//
// Created by Developer on 17.05.2021.
//

import Foundation

/**
* Factory to generate AddressInformation instance.
*/

class AddressInformationFactory {

private static var sharedAddressInformationFactory = AddressInformationFactory()

private init () {}

class func shared() -> AddressInformationFactory {
return sharedAddressInformationFactory
}

func getInstance(authorizationKey: String) -> AddressInformationProvider {

let addressInformationRepo = MerkleRepo(authorizationKey: authorizationKey)
let addressInformationServiceNetki = AddressInformationServiceNetki(addressInformationRepo: addressInformationRepo)
return AddressInformationProviderNetki(addressInformationService: addressInformationServiceNetki)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// AddressInformationProviderNetki.swift
// transactId-library-ios
//
// Created by Developer on 17.05.2021.
//

import Foundation

class AddressInformationProviderNetki: AddressInformationProvider {

private let addressInformationService: AddressInformationService

init(addressInformationService: AddressInformationService) {
self.addressInformationService = addressInformationService
}

func getAddressInformation(currency: AddressCurrency, address: String) throws -> AddressInformation? {
return try self.addressInformationService.getAddressInformation(currency: currency, address: address)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// AddressInformationProvider.swift
// transactId-library-ios
//
// Created by Developer on 17.05.2021.
//

import Foundation

/**
* Fetch the detailed information about an address.
*/
protocol AddressInformationProvider {

/**
* Fetch the information of a given address.
*
* @param currency of the address.
* @param address to fetch the information.
* @throws AddressProviderErrorException if there is an error fetching the information from the provider.
* @throws AddressProviderUnauthorizedException if there is an error with the authorization to connect to the provider.
* @return information of the address.
*/

func getAddressInformation(currency: AddressCurrency, address: String) throws -> AddressInformation?

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protocol AddressInformationRepo {
* @return information of the address.
*/

func getAddressInformation(currency: AddressCurrency, address: String) -> AddressInformation
func getAddressInformation(currency: AddressCurrency, address: String) throws -> AddressInformation?


}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import Foundation

protocol AddressInformationService {



/**
* Fetch the information of a given address.
*
Expand All @@ -20,6 +19,6 @@ protocol AddressInformationService {
* @return information of the address.
*/

func getAddressInformation(currency: AddressCurrency, address: String) -> AddressInformation
func getAddressInformation(currency: AddressCurrency, address: String) throws -> AddressInformation?

}
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
//
// AddressInformaionServiceNetki.swift
// AddressInformationServiceNetki.swift
// transactId-library-ios
//
// Created by Developer on 24.03.2021.
//

import Foundation

class AddressInformaionServiceNetki: AddressInformationService {
class AddressInformationServiceNetki: AddressInformationService {

private let addressInformationRepo: AddressInformationRepo

init(addressInformationRepo: AddressInformationRepo) {
self.addressInformationRepo = addressInformationRepo
}

func getAddressInformation(currency: AddressCurrency, address: String) -> AddressInformation {
return self.addressInformationRepo.getAddressInformation(currency: currency, address: address)
func getAddressInformation(currency: AddressCurrency, address: String) throws -> AddressInformation? {
return try self.addressInformationRepo.getAddressInformation(currency: currency, address: address)
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
//
// MerkleAddress.swift
// transactId-library-ios
//
// Created by Developer on 24.05.2021.
//

import Foundation

class MerkleAddress {

var identifier: String?
var balance: Double?
var beneficiary: Array<MerkleTagInformation> = []
var caseStatus: Int?
var caseStatusVerbose: String?
var currency: Int?
var currencyVerbose: String?
var earliestTransactionTime: String?
var latestTransactionTime: String?
var originator: Array<MerkleTagInformation> = []
var riskLevel: Int?
var riskLevelVerbose: String?
var merkleTags: MerkleTags?
var totalIncomingValue: String?
var totalIncomingValueUsd: String?
var totalOutgoingValue: String?
var totalOutgoingValueUsd: String?
var createdAt: String?
var updatedAt: String?

init (json: [String: Any]) {
if let identifier = json["identifier"] as? String {
self.identifier = identifier
}

if let balance = json["balance"] as? Double {
self.balance = balance
}

if let beneficiaryJson = json["beneficiary"] as? Array<[String: Any]> {
beneficiaryJson.forEach { (merkleTagInformationJson) in
self.beneficiary.append(MerkleTagInformation(json: merkleTagInformationJson))
}
}

if let caseStatus = json["case_status"] as? Int {
self.caseStatus = caseStatus
}

if let caseStatusVerbose = json["case_status_verbose"] as? String {
self.caseStatusVerbose = caseStatusVerbose
}

if let currency = json["currency"] as? Int {
self.currency = currency
}

if let currencyVerbose = json["currency_verbose"] as? String {
self.currencyVerbose = currencyVerbose
}

if let earliestTransactionTime = json["earliest_transaction_time"] as? String {
self.earliestTransactionTime = earliestTransactionTime
}

if let latestTransactionTime = json["latest_transaction_time"] as? String {
self.latestTransactionTime = latestTransactionTime
}

if let originatorJson = json["originator"] as? Array<[String: Any]> {
originatorJson.forEach { (merkleTagInformationJson) in
self.originator.append(MerkleTagInformation(json: merkleTagInformationJson))
}
}

if let riskLevel = json["risk_level"] as? Int {
self.riskLevel = riskLevel
}

if let riskLevelVerbose = json["risk_level_verbose"] as? String {
self.riskLevelVerbose = riskLevelVerbose
}

if let merkleTagsJson = json["tags"] as? [String: Any] {
self.merkleTags = MerkleTags(json: merkleTagsJson)
}

if let totalIncomingValue = json["total_incoming_value"] as? String {
self.totalIncomingValue = totalIncomingValue
}

if let totalIncomingValueUsd = json["total_incoming_value_usd"] as? String {
self.totalIncomingValueUsd = totalIncomingValueUsd
}

if let totalOutgoingValue = json["total_outgoing_value"] as? String {
self.totalOutgoingValue = totalOutgoingValue
}

if let totalOutgoingValueUsd = json["total_outgoing_value_usd"] as? String {
self.totalOutgoingValueUsd = totalOutgoingValueUsd
}

if let createdAt = json["created_at"] as? String {
self.createdAt = createdAt
}

if let updatedAt = json["updated_at"] as? String {
self.updatedAt = updatedAt
}

}
}

extension MerkleAddress {

func toAddressInformation() -> AddressInformation {
let addressInformation = AddressInformation()
addressInformation.identifier = self.identifier
addressInformation.balance = self.balance
self.beneficiary.forEach { (merkleTagInformation) in
addressInformation.beneficiary.append(merkleTagInformation.toAddressTagInformation())
}
addressInformation.caseStatus = self.caseStatus
addressInformation.caseStatusVerbose = self.caseStatusVerbose
addressInformation.currency = self.currency
addressInformation.currencyVerbose = self.currencyVerbose
addressInformation.earliestTransactionTime = self.earliestTransactionTime
addressInformation.latestTransactionTime = self.latestTransactionTime
self.originator.forEach { (merkleTagInformation) in
addressInformation.originator.append(merkleTagInformation.toAddressTagInformation())
}
addressInformation.riskLevel = self.riskLevel
addressInformation.riskLevelVerbose = self.riskLevelVerbose
addressInformation.tags = self.merkleTags?.toAddressTags()
addressInformation.totalIncomingValue = self.totalIncomingValue
addressInformation.totalIncomingValueUsd = self.totalIncomingValueUsd
addressInformation.totalOutgoingValue = self.totalOutgoingValue
addressInformation.totalOutgoingValueUsd = self.totalOutgoingValueUsd
addressInformation.createdAt = self.createdAt
addressInformation.updatedAt = self.updatedAt
return addressInformation
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// MerkleTagInformation.swift
// transactId-library-ios
//
// Created by Developer on 24.05.2021.
//

import Foundation

class MerkleTagInformation {

var tagNameVerbose: String?
var tagSubtypeVerbose: String?
var tagTypeVerbose: String?
var tagTotalValueUsd: String?


init(json: [String: Any]) {
if let tagNameVerbose = json["tag_name_verbose"] as? String {
self.tagNameVerbose = tagNameVerbose
}

if let tagSubtypeVerbose = json["tag_subtype_verbose"] as? String {
self.tagSubtypeVerbose = tagSubtypeVerbose
}

if let tagTypeVerbose = json["tag_type_verbose"] as? String {
self.tagTypeVerbose = tagTypeVerbose
}

if let tagTotalValueUsd = json["total_value_usd"] as? String {
self.tagTotalValueUsd = tagTotalValueUsd
}
}
}

extension MerkleTagInformation {

func toAddressTagInformation() -> AddressTagInformation {
let addressTagInformation = AddressTagInformation()
addressTagInformation.tagNameVerbose = self.tagNameVerbose
addressTagInformation.tagSubtypeVerbose = self.tagSubtypeVerbose
addressTagInformation.tagTypeVerbose = self.tagTypeVerbose
addressTagInformation.totalValueUsd = self.tagTotalValueUsd
return addressTagInformation

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// MerkleTags.swift
// transactId-library-ios
//
// Created by Developer on 24.05.2021.
//

import Foundation

class MerkleTags {
var owner: MerkleTagInformation?
var user: MerkleTagInformation?

init(json: [String: Any]) {
if let ownerJson = json["owner"] as? [String: Any] {
self.owner = MerkleTagInformation(json: ownerJson)
}

if let userJson = json["user"] as? [String: Any] {
self.user = MerkleTagInformation(json: userJson)
}
}
}

extension MerkleTags {
func toAddressTags() -> AddressTags {
let addressTags = AddressTags()
addressTags.owner = self.owner?.toAddressTagInformation()
addressTags.user = self.user?.toAddressTagInformation()
return addressTags
}
}
Loading