Get started: consolidate, start updating Node.js

This commit is contained in:
mDuo13
2021-10-05 17:22:15 -07:00
parent d04a12fc0d
commit 6fc9afbd7e
12 changed files with 141 additions and 591 deletions

View File

@@ -0,0 +1,28 @@
// Construct a network client
HttpUrl rippledUrl = HttpUrl
.get("https://s.altnet.rippletest.net:51234/");
XrplClient xrplClient = new XrplClient(rippledUrl);
// Create a Wallet using a WalletFactory
WalletFactory walletFactory = DefaultWalletFactory.getInstance();
Wallet testWallet = walletFactory.randomWallet(true).wallet();
// Get the Classic and X-Addresses from testWallet
Address classicAddress = testWallet.classicAddress();
XAddress xAddress = testWallet.xAddress();
System.out.println("Classic Address: " + classicAddress);
System.out.println("X-Address: " + xAddress);
// Fund the account using the testnet Faucet
FaucetClient faucetClient = FaucetClient
.construct(HttpUrl.get("https://faucet.altnet.rippletest.net"));
faucetClient.fundAccount(FundAccountRequest.of(classicAddress));
// Look up your Account Info
AccountInfoRequestParams requestParams =
AccountInfoRequestParams.of(classicAddress);
AccountInfoResult accountInfoResult =
xrplClient.accountInfo(requestParams);
// Print the result
System.out.println(accountInfoResult);