Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

Commit

Permalink
UniversalAssetID from wallet core (#68)
Browse files Browse the repository at this point in the history
* use big int for gas limit / gas price

* remove UniversalAssetID

* update wallet core version
  • Loading branch information
hewigovens authored Nov 20, 2020
1 parent 0447d29 commit 812111a
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 123 deletions.
14 changes: 7 additions & 7 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ PODS:
- BigInt (5.2.0)
- CryptoSwift (1.3.2)
- SwiftLint (0.39.2)
- SwiftProtobuf (1.12.0)
- TrustSDK/Client (1.4.3):
- SwiftProtobuf (1.13.0)
- TrustSDK/Client (1.4.4):
- BigInt
- TrustWalletCore/Types
- TrustSDK/Wallet (1.4.3):
- TrustSDK/Wallet (1.4.4):
- TrustSDK/Client
- TrustWalletCore/Types (2.3.2):
- TrustWalletCore/Types (2.3.7):
- SwiftProtobuf

DEPENDENCIES:
Expand All @@ -32,9 +32,9 @@ SPEC CHECKSUMS:
BigInt: f668a80089607f521586bbe29513d708491ef2f7
CryptoSwift: 093499be1a94b0cae36e6c26b70870668cb56060
SwiftLint: 22ccbbe3b8008684be5955693bab135e0ed6a447
SwiftProtobuf: 4ef85479c18ca85b5482b343df9c319c62bda699
TrustSDK: 22058b92df9d20c9e1a9e8cfbf738f6baa67fba1
TrustWalletCore: 296d747041462b68851f1649a0d75f04723f6a33
SwiftProtobuf: fd4693388a96c8c2df35d3b063272b0e7c499d00
TrustSDK: 447cc2dfacf15bd1624e1794ac728e986c283534
TrustWalletCore: c00c4f68a16a7bce915dba327c7d5e5ef67cdf8b

PODFILE CHECKSUM: 3cd8abdd82cb2787c7ceb3f28154a7ede783339d

Expand Down
47 changes: 0 additions & 47 deletions Example/Tests/AssetIDTests.swift

This file was deleted.

7 changes: 4 additions & 3 deletions Example/Tests/CommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// file LICENSE at the root of the source code distribution tree.

import XCTest
import BigInt
import WalletCore
@testable import TrustSDK

Expand Down Expand Up @@ -110,15 +111,15 @@ class CommandTests: XCTestCase {
let app = "trust"
let wallet = WalletApp(scheme: app, installURL: URL(string: "https://trustwallet.com")!)
let tx = TrustSDK.Transaction(
asset: UniversalAssetID(coin: .ethereum),
asset: UniversalAssetID(coin: .ethereum, token: ""),
to: "0x728B02377230b5df73Aa4E3192E89b6090DD7312",
amount: "0.01",
action: .transfer,
confirm: .sign,
from: nil,
nonce: 447,
feePrice: "2112000000",
feeLimit: "21000",
feePrice: BigInt(2112000000),
feeLimit: BigInt(21000),
meta: "0xasdf"
)

Expand Down
4 changes: 0 additions & 4 deletions Example/TrustSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
7507FFE3240D774300DE2741 /* WalletRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7507FFE2240D774300DE2741 /* WalletRequestTests.swift */; };
7598AD192414175000421EFA /* DictionaryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7598AD182414175000421EFA /* DictionaryTests.swift */; };
75CD0D8324A41DC300242DA3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 75CD0D8224A41DC300242DA3 /* Main.storyboard */; };
BB5AE6D8256276B800D1D440 /* AssetIDTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB5AE6D7256276B800D1D440 /* AssetIDTests.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -54,7 +53,6 @@
973C7B142BAB8746D0C53AF2 /* TrustSDK.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = TrustSDK.podspec; path = ../TrustSDK.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
9CE43E415D1BA0F22441C393 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
A5726054D0480EABD61CA7E8 /* Pods-TrustSDK_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TrustSDK_Tests.debug.xcconfig"; path = "Target Support Files/Pods-TrustSDK_Tests/Pods-TrustSDK_Tests.debug.xcconfig"; sourceTree = "<group>"; };
BB5AE6D7256276B800D1D440 /* AssetIDTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetIDTests.swift; sourceTree = "<group>"; };
C5D9043738C8AAF9420A137C /* Pods_TrustSDK_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_TrustSDK_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C9B18CC4B138BEA7D295FC63 /* Pods-TrustSDK_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TrustSDK_Example.debug.xcconfig"; path = "Target Support Files/Pods-TrustSDK_Example/Pods-TrustSDK_Example.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -137,7 +135,6 @@
isa = PBXGroup;
children = (
7598AD172414171700421EFA /* Extensions */,
BB5AE6D7256276B800D1D440 /* AssetIDTests.swift */,
7507FFE2240D774300DE2741 /* WalletRequestTests.swift */,
7507FFE0240D75AE00DE2741 /* WalletResponseTests.swift */,
7507FFDD240D738100DE2741 /* CommandTests.swift */,
Expand Down Expand Up @@ -393,7 +390,6 @@
7507FFE1240D75AE00DE2741 /* WalletResponseTests.swift in Sources */,
7507FFDF240D73BD00DE2741 /* CommandTests.swift in Sources */,
607FACEC1AFB9204008FA782 /* RequestRegistryTests.swift in Sources */,
BB5AE6D8256276B800D1D440 /* AssetIDTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
2 changes: 1 addition & 1 deletion Example/TrustSDK/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ViewController: UIViewController {

@IBAction func signSimpleEthTx(sender: UIButton) {
let tx = TrustSDK.Transaction(
asset: UniversalAssetID(coin: .ethereum),
asset: UniversalAssetID(coin: .ethereum, token: ""),
to: "0x728B02377230b5df73Aa4E3192E89b6090DD7312",
amount: "0.01",
action: .transfer,
Expand Down
2 changes: 1 addition & 1 deletion TrustSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TrustSDK'
s.version = '1.4.3'
s.version = '1.4.4'
s.summary = 'Trust Wallet SDK'
s.homepage = 'https://github.com/TrustWallet/TrustSDK-iOS'
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
29 changes: 21 additions & 8 deletions TrustSDK/Classes/Client/Types/Transaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// file LICENSE at the root of the source code distribution tree.

import Foundation
import BigInt
import WalletCore

public extension TrustSDK {
struct Transaction: Equatable {
Expand All @@ -19,8 +21,8 @@ public extension TrustSDK {
public let confirm: ConfirmType
public let from: String?
public let nonce: UInt64?
public let feeLimit: String?
public let feePrice: String?
public let feeLimit: BigInt?
public let feePrice: BigInt?
public let meta: String?

public init(
Expand All @@ -31,8 +33,8 @@ public extension TrustSDK {
confirm: ConfirmType,
from: String? = nil,
nonce: UInt64? = nil,
feePrice: String? = nil,
feeLimit: String? = nil,
feePrice: BigInt? = nil,
feeLimit: BigInt? = nil,
meta: String? = nil
) {
self.asset = asset
Expand Down Expand Up @@ -63,9 +65,20 @@ public extension TrustSDK {
self.action = action
self.confirm = confirm
self.from = params["from"] as? String
self.feeLimit = params["fee_limit"] as? String
self.feePrice = params["fee_price"] as? String
self.meta = params["meta"] as? String

if let limit = params["fee_limit"] as? String {
self.feeLimit = BigInt(limit)
} else {
self.feeLimit = nil
}

if let price = params["fee_price"] as? String {
self.feePrice = BigInt(price)
} else {
self.feePrice = nil
}

if let nonceStr = params["nonce"] as? String {
self.nonce = UInt64(nonceStr)
} else {
Expand All @@ -88,10 +101,10 @@ public extension TrustSDK {
params["nonce"] = nonce
}
if let feePrice = feePrice {
params["fee_price"] = feePrice
params["fee_price"] = feePrice.description
}
if let feeLimit = feeLimit {
params["fee_limit"] = feeLimit
params["fee_limit"] = feeLimit.description
}
if let meta = meta {
params["meta"] = meta
Expand Down
52 changes: 0 additions & 52 deletions TrustSDK/Classes/Client/Types/UniversalAssetID.swift

This file was deleted.

0 comments on commit 812111a

Please sign in to comment.