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

Add tokenID to PaymentRequest #200

Merged
merged 3 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
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
}
}