Skip to content

Commit

Permalink
Add tokenID to PaymentRequest (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
plarson committed Oct 5, 2022
1 parent 79aac13 commit dcb9ef9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
14 changes: 7 additions & 7 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ PODS:
- gRPC-Swift
- SwiftProtobuf (~> 1.5)
- Logging (1.4.0)
- MobileCoin (1.3.0-pre2)
- MobileCoin/Core (1.3.0-pre2):
- MobileCoin (1.3.0-pre3)
- MobileCoin/Core (1.3.0-pre3):
- gRPC-Swift (= 1.0.0)
- LibMobileCoin/Core (= 1.3.0-pre0)
- Logging (~> 1.4)
Expand All @@ -33,7 +33,7 @@ PODS:
- SwiftNIOHPACK (~> 1.16.3)
- SwiftNIOHTTP1 (~> 2.40.0)
- SwiftProtobuf
- MobileCoin/Core/ProtocolUnitTests (1.3.0-pre2):
- MobileCoin/Core/ProtocolUnitTests (1.3.0-pre3):
- gRPC-Swift (= 1.0.0)
- LibMobileCoin/Core (= 1.3.0-pre0)
- Logging (~> 1.4)
Expand All @@ -42,9 +42,9 @@ PODS:
- SwiftNIOHPACK (~> 1.16.3)
- SwiftNIOHTTP1 (~> 2.40.0)
- SwiftProtobuf
- MobileCoin/IntegrationTests (1.3.0-pre2)
- MobileCoin/PerformanceTests (1.3.0-pre2)
- MobileCoin/Tests (1.3.0-pre2)
- MobileCoin/IntegrationTests (1.3.0-pre3)
- MobileCoin/PerformanceTests (1.3.0-pre3)
- MobileCoin/Tests (1.3.0-pre3)
- SwiftLint (0.47.1)
- SwiftNIO (2.40.0):
- _NIODataStructures (= 2.40.0)
Expand Down Expand Up @@ -224,7 +224,7 @@ SPEC CHECKSUMS:
Keys: a576f4c9c1c641ca913a959a9c62ed3f215a8de9
LibMobileCoin: 8c5f745d141e6e619dc73d79abe7bf828dfc4362
Logging: beeb016c9c80cf77042d62e83495816847ef108b
MobileCoin: 4f1866bf7b018cfa5228ac644e12bacde484419a
MobileCoin: a183a239a699ece0cad4ddd0d966f76af0cbcacc
SwiftLint: f80f1be7fa96d30e0aa68e58d45d4ea1ccaac519
SwiftNIO: 829958aab300642625091f82fc2f49cb7cf4ef24
SwiftNIOConcurrencyHelpers: 697370136789b1074e4535eaae75cbd7f900370e
Expand Down
14 changes: 7 additions & 7 deletions ExampleHTTP/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ PODS:
- LibMobileCoin/CoreHTTP (1.3.0-pre0):
- SwiftProtobuf (~> 1.5)
- Logging (1.4.0)
- MobileCoin (1.3.0-pre2)
- MobileCoin/CoreHTTP (1.3.0-pre2):
- MobileCoin (1.3.0-pre3)
- MobileCoin/CoreHTTP (1.3.0-pre3):
- LibMobileCoin/CoreHTTP (= 1.3.0-pre0)
- Logging (~> 1.4)
- SwiftLint
- MobileCoin/CoreHTTP/HttpProtocolUnitTests (1.3.0-pre2):
- MobileCoin/CoreHTTP/HttpProtocolUnitTests (1.3.0-pre3):
- LibMobileCoin/CoreHTTP (= 1.3.0-pre0)
- Logging (~> 1.4)
- SwiftLint
- MobileCoin/IntegrationTests (1.3.0-pre2)
- MobileCoin/PerformanceTests (1.3.0-pre2)
- MobileCoin/Tests (1.3.0-pre2)
- MobileCoin/IntegrationTests (1.3.0-pre3)
- MobileCoin/PerformanceTests (1.3.0-pre3)
- MobileCoin/Tests (1.3.0-pre3)
- SwiftLint (0.47.1)
- SwiftProtobuf (1.19.0)

Expand Down Expand Up @@ -48,7 +48,7 @@ SPEC CHECKSUMS:
Keys: a576f4c9c1c641ca913a959a9c62ed3f215a8de9
LibMobileCoin: 8c5f745d141e6e619dc73d79abe7bf828dfc4362
Logging: beeb016c9c80cf77042d62e83495816847ef108b
MobileCoin: 4f1866bf7b018cfa5228ac644e12bacde484419a
MobileCoin: a183a239a699ece0cad4ddd0d966f76af0cbcacc
SwiftLint: f80f1be7fa96d30e0aa68e58d45d4ea1ccaac519
SwiftProtobuf: 6ef3f0e422ef90d6605ca20b21a94f6c1324d6b3

Expand Down
2 changes: 1 addition & 1 deletion MobileCoin.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Pod::Spec.new do |s|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

s.name = "MobileCoin"
s.version = "1.3.0-pre2"
s.version = "1.3.0-pre3"
s.summary = "A library for communicating with MobileCoin network"

s.author = "MobileCoin"
Expand Down
12 changes: 11 additions & 1 deletion Sources/Encodings/PaymentRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ public struct PaymentRequest {
public let publicAddress: PublicAddress
public let value: UInt64?
public let memo: String?
public let tokenID: UInt64

/// # Notes:
/// * Providing a `value` of `0` is the same as passing `nil`, meaning no value is specified.
/// * Providing an empty string for `memo` is the same as passing `nil`, meaning no memo is
/// specified.
public init(publicAddress: PublicAddress, value: UInt64? = nil, memo: String? = nil) {
public init(
publicAddress: PublicAddress,
value: UInt64? = nil,
memo: String? = nil,
tokenID: UInt64 = 0
) {
self.publicAddress = publicAddress

if let value = value, value != 0 {
Expand All @@ -28,6 +34,8 @@ public struct PaymentRequest {
} else {
self.memo = nil
}

self.tokenID = tokenID
}
}

Expand All @@ -42,6 +50,7 @@ extension PaymentRequest {
self.publicAddress = publicAddress
self.value = paymentRequest.value != 0 ? paymentRequest.value : nil
self.memo = !paymentRequest.memo.isEmpty ? paymentRequest.memo : nil
self.tokenID = paymentRequest.tokenID
}
}

Expand All @@ -55,5 +64,6 @@ extension Printable_PaymentRequest {
if let memo = paymentRequest.memo {
self.memo = memo
}
self.tokenID = paymentRequest.tokenID
}
}

0 comments on commit dcb9ef9

Please sign in to comment.