Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #42 from kinecosystem/tx-init-crash
Browse files Browse the repository at this point in the history
Fix rare transaction init crash
  • Loading branch information
samdowd authored Mar 11, 2022
2 parents d56cc78 + a04d7ae commit cffc624
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 28 deletions.
2 changes: 1 addition & 1 deletion KinBase.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
Pod::Spec.new do |s|
s.name = 'KinBase'
s.version = '2.1.1'
s.version = '2.1.2'
s.summary = 'Kin SDK for iOS'

s.description = <<-DESC
Expand Down
4 changes: 2 additions & 2 deletions KinBase/KinBase.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.1.1;
MARKETING_VERSION = 2.1.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-l\"c++\"",
Expand Down Expand Up @@ -1841,7 +1841,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.1.1;
MARKETING_VERSION = 2.1.2;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down
21 changes: 12 additions & 9 deletions KinBase/KinBase/Src/Model/KinTransaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,26 @@ public class KinTransaction: Equatable, KinTransactionType {
self.network = network
self.invoiceList = invoiceList

if let solanaTransaction = Transaction(data: Data(envelopeXdrBytes)) {
self.transactionHash = solanaTransaction.transactionHash
self.sourceAccount = solanaTransaction.sourceAccount
self.memo = solanaTransaction.memo
self.paymentOperations = solanaTransaction.paymentOperations
} else {
guard let historyItem = historyItem else {
if let historyItem = historyItem {
guard let payments = historyItem.paymentsArray as NSArray as? [APBTransactionV4HistoryItem_Payment] else {
throw Errors.unknown
}
guard let payment = payments.first else {
throw Errors.unknown
}
let payments = historyItem.paymentsArray as NSArray as! [APBTransactionV4HistoryItem_Payment]
let payment = payments.first!
self.transactionHash = KinTransactionHash(historyItem.transactionId.value)
self.sourceAccount = payment.source.publicKey
self.memo = KinMemo.none
self.paymentOperations = payments.compactMap {
KinPaymentOperation(amount: Kin($0.amount), source: $0.source.publicKey, destination: $0.destination.publicKey, isNonNativeAsset: false)
}
} else if let solanaTransaction = Transaction(data: Data(envelopeXdrBytes)) {
self.transactionHash = solanaTransaction.transactionHash
self.sourceAccount = solanaTransaction.sourceAccount
self.memo = solanaTransaction.memo
self.paymentOperations = solanaTransaction.paymentOperations
} else {
throw Errors.unknown
}
}

Expand Down
2 changes: 1 addition & 1 deletion KinBase/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The KinBase module is the foundation upon which the rest of the SDK stands.
## Installation
Add the following to your Podfile.
```
pod 'KinBase', '~> 2.1.1'
pod 'KinBase', '~> 2.1.2'
```

## Overview
Expand Down
2 changes: 1 addition & 1 deletion KinDesign.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
Pod::Spec.new do |s|
s.name = 'KinDesign'
s.version = '2.1.1'
s.version = '2.1.2'
s.summary = 'Kin Design Library for iOS'

s.description = <<-DESC
Expand Down
4 changes: 2 additions & 2 deletions KinDesign/KinDesign.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.1.1;
MARKETING_VERSION = 2.1.2;
PRODUCT_BUNDLE_IDENTIFIER = org.kin..KinDesign;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -458,7 +458,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.1.1;
MARKETING_VERSION = 2.1.2;
PRODUCT_BUNDLE_IDENTIFIER = org.kin..KinDesign;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down
2 changes: 1 addition & 1 deletion KinDesign/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ All of these components can be tested out and browsed in the [sample app](../Kin
## Installation
Add the following to your project's Podfile.
```
pod 'KinDesign', '~> 2.1.1'
pod 'KinDesign', '~> 2.1.2'
```

### Primary Button
Expand Down
4 changes: 2 additions & 2 deletions KinSampleApp/KinSampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.1.1;
MARKETING_VERSION = 2.1.2;
PRODUCT_BUNDLE_IDENTIFIER = org.kin..KinSampleApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -602,7 +602,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.1.1;
MARKETING_VERSION = 2.1.2;
PRODUCT_BUNDLE_IDENTIFIER = org.kin..KinSampleApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
6 changes: 3 additions & 3 deletions KinUX.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
Pod::Spec.new do |s|
s.name = 'KinUX'
s.version = '2.1.1'
s.version = '2.1.2'
s.summary = 'UX Library for Kin SDK iOS'

s.description = <<-DESC
Expand All @@ -20,8 +20,8 @@ Pod::Spec.new do |s|

s.source_files = 'KinUX/KinUX/Src/**/*'

s.dependency 'KinBase', '~> 2.1.1'
s.dependency 'KinDesign', '~> 2.1.1'
s.dependency 'KinBase', '~> 2.1.2'
s.dependency 'KinDesign', '~> 2.1.2'

# Dependencies needed for KinGrpcApi
s.dependency 'gRPC-ProtoRPC'
Expand Down
4 changes: 2 additions & 2 deletions KinUX/KinUX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.1.1;
MARKETING_VERSION = 2.1.2;
PRODUCT_BUNDLE_IDENTIFIER = org.kin..KinUX;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -619,7 +619,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.1.1;
MARKETING_VERSION = 2.1.2;
PRODUCT_BUNDLE_IDENTIFIER = org.kin..KinUX;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down
2 changes: 1 addition & 1 deletion KinUX/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The KinUX module provides an easy to use out of the box spend flow UI that is pr
Add the following to your project's Podfile.
This will also transitively pull in KinBase and KinDesign into your project as well.
```
pod 'KinUX', '~> 2.1.1'
pod 'KinUX', '~> 2.1.2'
```

## Overview
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ In your Podfile

```
// If you just want to access the blockchain & no UI
pod 'KinBase', '~> 2.1.1'
pod 'KinBase', '~> 2.1.2'
// Add spend to use the modal spend flow to allow users to buy things with Kin
pod 'KinUX', '~> 2.1.1'
pod 'KinUX', '~> 2.1.2'
// Add design for direct access to UI views you can use in your own app
pod 'KinDesign', '~> 2.1.1'
pod 'KinDesign', '~> 2.1.2'
```

## Sample App
Expand Down

0 comments on commit cffc624

Please sign in to comment.