9
9
* Licensed under the Apache License, Version 2.0 (the "License");
10
10
* you may not use this file except in compliance with the License.
11
11
* You may obtain a copy of the License at
12
- *
12
+ *
13
13
* http://www.apache.org/licenses/LICENSE-2.0
14
- *
14
+ *
15
15
* Unless required by applicable law or agreed to in writing, software
16
16
* distributed under the License is distributed on an "AS IS" BASIS,
17
17
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
29
import org .xrpl .xrpl4j .model .ledger .NfTokenOfferObject ;
30
30
import org .xrpl .xrpl4j .model .transactions .Address ;
31
31
import org .xrpl .xrpl4j .model .transactions .Hash256 ;
32
+ import org .xrpl .xrpl4j .model .transactions .IssuedCurrencyAmount ;
32
33
import org .xrpl .xrpl4j .model .transactions .NfTokenId ;
33
34
import org .xrpl .xrpl4j .model .transactions .XrpCurrencyAmount ;
34
35
35
- public class NfTokenOfferObjectJsonTests extends AbstractJsonTest {
36
+ public class NfTokenOfferObjectJsonTests extends AbstractJsonTest {
36
37
37
38
@ Test
38
- public void testJson () throws JsonProcessingException , JSONException {
39
-
39
+ public void testJsonWithXrpAmount () throws JsonProcessingException , JSONException {
40
40
NfTokenOfferObject object = NfTokenOfferObject .builder ()
41
41
.amount (XrpCurrencyAmount .ofDrops (10000 ))
42
42
.destination (Address .of ("rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn" ))
@@ -60,4 +60,40 @@ public void testJson() throws JsonProcessingException, JSONException {
60
60
61
61
assertCanSerializeAndDeserialize (object , json );
62
62
}
63
+
64
+ @ Test
65
+ public void testJsonWithIssuedCurrencyAmount () throws JsonProcessingException , JSONException {
66
+ NfTokenOfferObject object = NfTokenOfferObject .builder ()
67
+ .amount (
68
+ IssuedCurrencyAmount .builder ()
69
+ .currency ("USD" )
70
+ .issuer (Address .of ("rsjYGpMWQeNBXbUTkVz4ZKzHefgZSr6rys" ))
71
+ .value ("10" )
72
+ .build ()
73
+ )
74
+ .destination (Address .of ("rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn" ))
75
+ .owner (Address .of ("rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW" ))
76
+ .previousTransactionId (Hash256 .of ("E3FE6EA3D48F0C2B639448020EA4F03D4F4F8FFDB243A852A0F59177921B4879" ))
77
+ .previousTransactionLedgerSequence (UnsignedInteger .valueOf (14090896 ))
78
+ .nfTokenId (NfTokenId .of ("000B013A95F14B0044F78A264E41713C64B5F89242540EE208C3098E00000D65" ))
79
+ .flags (NfTokenOfferFlags .BUY_TOKEN )
80
+ .build ();
81
+
82
+ String json = "{\n " +
83
+ " \" Flags\" : 1,\n " +
84
+ " \" Amount\" : {" +
85
+ " \" currency\" : \" USD\" ,\n " +
86
+ " \" issuer\" : \" rsjYGpMWQeNBXbUTkVz4ZKzHefgZSr6rys\" ," +
87
+ " \" value\" : \" 10\" " +
88
+ " },\n " +
89
+ " \" Owner\" : \" rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW\" ,\n " +
90
+ " \" NFTokenID\" : \" 000B013A95F14B0044F78A264E41713C64B5F89242540EE208C3098E00000D65\" ,\n " +
91
+ " \" Destination\" : \" rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn\" ,\n " +
92
+ " \" PreviousTxnID\" : \" E3FE6EA3D48F0C2B639448020EA4F03D4F4F8FFDB243A852A0F59177921B4879\" ,\n " +
93
+ " \" PreviousTxnLgrSeq\" : 14090896,\n " +
94
+ " \" LedgerEntryType\" : \" NFTokenOffer\" \n " +
95
+ "}" ;
96
+
97
+ assertCanSerializeAndDeserialize (object , json );
98
+ }
63
99
}
0 commit comments