Skip to content

Commit

Permalink
Merge pull request #17 from uma-universal-money-address/fix/encodedef…
Browse files Browse the repository at this point in the history
…ault

Encode default values for tag and routes
  • Loading branch information
jklein24 authored Jan 20, 2024
2 parents bee2bed + 39abbf2 commit 3556ac6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions javatest/src/test/java/me/uma/javatest/UmaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

public class UmaTest {
UmaProtocolHelper umaProtocolHelper = new UmaProtocolHelper(new InMemoryPublicKeyCache(), new TestUmaRequester());
private static String PUBKEY_HEX = "04f2998ab056897ddb91b5e6fad1e4bb6c4b7dda427409f667d0f4694b553e4feeeb08936c2993f7b931f6a3fa7e846f11165fae222de5e4a55c12def21a7c9fcf";
private static String PRIVKEY_HEX = "10fbbee8f689b207bb22df2dfa27827ae9ae02e265980ea09ef5101ed5fb508f";
private static final String PUBKEY_HEX = "04f2998ab056897ddb91b5e6fad1e4bb6c4b7dda427409f667d0f4694b553e4feeeb08936c2993f7b931f6a3fa7e846f11165fae222de5e4a55c12def21a7c9fcf";
private static final String PRIVKEY_HEX = "10fbbee8f689b207bb22df2dfa27827ae9ae02e265980ea09ef5101ed5fb508f";


@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package me.uma.protocol

import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.descriptors.buildClassSerialDescriptor
import kotlinx.serialization.descriptors.element
import kotlinx.serialization.encodeToString
import kotlinx.serialization.encoding.CompositeDecoder
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
Expand All @@ -29,6 +26,7 @@ import kotlinx.serialization.json.Json
* support and VASP1's specified preference in the LnurlpRequest. For the version negotiation flow, see
* https://static.swimlanes.io/87f5d188e080cb8e0494e46f80f2ae74.png
*/
@OptIn(ExperimentalSerializationApi::class)
@Serializable
data class LnurlpResponse(
val callback: String,
Expand All @@ -40,6 +38,7 @@ data class LnurlpResponse(
val requiredPayerData: PayerDataOptions,
val compliance: LnurlComplianceResponse,
val umaVersion: String,
@EncodeDefault
val tag: String = "payRequest",
) {
fun toJson() = Json.encodeToString(this)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package me.uma.protocol

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.encodeToString
import kotlinx.serialization.*
import kotlinx.serialization.json.Json

/**
Expand All @@ -14,12 +12,14 @@ import kotlinx.serialization.json.Json
* @property compliance The compliance data from the receiver, including utxo info.
* @property paymentInfo The payment info from the receiver, including currency and an updated conversion rate.
*/
@OptIn(ExperimentalSerializationApi::class)
@Serializable
data class PayReqResponse(
@SerialName("pr")
val encodedInvoice: String,
val compliance: PayReqResponseCompliance,
val paymentInfo: PayReqResponsePaymentInfo,
@EncodeDefault
val routes: List<Route> = emptyList(),
) {
fun toJson() = Json.encodeToString(this)
Expand Down

0 comments on commit 3556ac6

Please sign in to comment.