|
25 | 25 | import com.fasterxml.jackson.core.JsonProcessingException; |
26 | 26 | import com.google.common.base.Strings; |
27 | 27 | import com.google.common.primitives.UnsignedInteger; |
28 | | -import okhttp3.HttpUrl; |
29 | 28 | import org.junit.jupiter.api.Test; |
30 | 29 | import org.xrpl.xrpl4j.client.JsonRpcClientErrorException; |
31 | | -import org.xrpl.xrpl4j.client.faucet.FaucetClient; |
32 | | -import org.xrpl.xrpl4j.client.faucet.FundAccountRequest; |
33 | 30 | import org.xrpl.xrpl4j.crypto.keys.KeyPair; |
34 | | -import org.xrpl.xrpl4j.crypto.keys.Seed; |
35 | 31 | import org.xrpl.xrpl4j.crypto.signing.SingleSignedTransaction; |
36 | 32 | import org.xrpl.xrpl4j.crypto.signing.bc.BcSignatureService; |
37 | 33 | import org.xrpl.xrpl4j.model.client.accounts.AccountInfoResult; |
38 | | -import org.xrpl.xrpl4j.model.client.common.LedgerIndex; |
39 | 34 | import org.xrpl.xrpl4j.model.client.common.LedgerSpecifier; |
40 | 35 | import org.xrpl.xrpl4j.model.client.fees.FeeResult; |
41 | 36 | import org.xrpl.xrpl4j.model.client.fees.FeeUtils; |
|
49 | 44 | import org.xrpl.xrpl4j.model.ledger.LedgerObject; |
50 | 45 | import org.xrpl.xrpl4j.model.transactions.AccountSet; |
51 | 46 | import org.xrpl.xrpl4j.model.transactions.AccountSet.AccountSetFlag; |
52 | | -import org.xrpl.xrpl4j.model.transactions.Address; |
53 | | -import org.xrpl.xrpl4j.model.transactions.ImmutableTrustSet; |
54 | | -import org.xrpl.xrpl4j.model.transactions.IssuedCurrencyAmount; |
55 | | -import org.xrpl.xrpl4j.model.transactions.TrustSet; |
56 | | -import org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount; |
57 | 47 |
|
58 | | -import java.math.BigDecimal; |
59 | 48 | import java.util.Objects; |
60 | 49 |
|
61 | 50 | /** |
|
66 | 55 | */ |
67 | 56 | public class AccountSetIT extends AbstractIT { |
68 | 57 |
|
69 | | - @Test |
70 | | - void name2() throws JsonRpcClientErrorException, JsonProcessingException { |
71 | | - KeyPair keyPair1 = constructRandomAccount(); |
72 | | - KeyPair keyPair2 = constructRandomAccount(); |
73 | | - |
74 | | - AccountInfoResult accountInfo1 = this.scanForResult( |
75 | | - () -> this.getValidatedAccountInfo(keyPair1.publicKey().deriveAddress()) |
76 | | - ); |
77 | | - AccountInfoResult accountInfo2 = this.scanForResult( |
78 | | - () -> this.getValidatedAccountInfo(keyPair2.publicKey().deriveAddress()) |
79 | | - ); |
80 | | - |
81 | | - ImmutableTrustSet trustSet1 = TrustSet.builder() |
82 | | - .account(keyPair1.publicKey().deriveAddress()) |
83 | | - .sequence(accountInfo1.accountData().sequence()) |
84 | | - .fee(XrpCurrencyAmount.ofXrp(BigDecimal.ONE)) |
85 | | - .lastLedgerSequence( |
86 | | - accountInfo1.ledgerIndexSafe().plus(LedgerIndex.of(UnsignedInteger.valueOf(10))).unsignedIntegerValue()) |
87 | | - .limitAmount( |
88 | | - IssuedCurrencyAmount.builder() |
89 | | - .currency("USD") |
90 | | - .value("100000") |
91 | | - .issuer(Address.of("rne3bStAJifMTBg7WzsmwzaMMY5XhAAuRe")) |
92 | | - .build() |
93 | | - ) |
94 | | - .signingPublicKey(keyPair1.publicKey()) |
95 | | - .build(); |
96 | | - |
97 | | - ImmutableTrustSet trustSet2 = TrustSet.builder() |
98 | | - .account(keyPair2.publicKey().deriveAddress()) |
99 | | - .sequence(accountInfo2.accountData().sequence()) |
100 | | - .fee(XrpCurrencyAmount.ofXrp(BigDecimal.ONE)) |
101 | | - .lastLedgerSequence( |
102 | | - accountInfo2.ledgerIndexSafe().plus(LedgerIndex.of(UnsignedInteger.valueOf(10))).unsignedIntegerValue()) |
103 | | - .limitAmount( |
104 | | - IssuedCurrencyAmount.builder() |
105 | | - .currency("USD") |
106 | | - .value("100000") |
107 | | - .issuer(Address.of("rne3bStAJifMTBg7WzsmwzaMMY5XhAAuRe")) |
108 | | - .build() |
109 | | - ) |
110 | | - .signingPublicKey(keyPair2.publicKey()) |
111 | | - .build(); |
112 | | - |
113 | | - SingleSignedTransaction<ImmutableTrustSet> signed1 = signatureService.sign(keyPair1.privateKey(), trustSet1); |
114 | | - SingleSignedTransaction<ImmutableTrustSet> signed2 = signatureService.sign(keyPair2.privateKey(), trustSet2); |
115 | | - SubmitResult<ImmutableTrustSet> submitResult1 = xrplClient.submit(signed1); |
116 | | - SubmitResult<ImmutableTrustSet> submitResult2 = xrplClient.submit(signed2); |
117 | | - assertThat(submitResult1.engineResult()).isEqualTo("tesSUCCESS"); |
118 | | - assertThat(submitResult2.engineResult()).isEqualTo("tesSUCCESS"); |
119 | | - System.out.printf("Account: %s. TrustSet hash: %s%n", keyPair1.publicKey().deriveAddress(), signed1.hash()); |
120 | | - System.out.printf("Account: %s. TrustSet hash: %s%n", keyPair2.publicKey().deriveAddress(), signed2.hash()); |
121 | | - } |
122 | | - |
123 | 58 | @Test |
124 | 59 | public void enableAllAndDisableOne() throws JsonRpcClientErrorException, JsonProcessingException { |
125 | 60 |
|
|
0 commit comments