Package org.xrpl.xrpl4j.wallet
Class DefaultWalletFactory
- java.lang.Object
-
- org.xrpl.xrpl4j.wallet.DefaultWalletFactory
-
- All Implemented Interfaces:
WalletFactory
public class DefaultWalletFactory extends Object implements WalletFactory
Default implementation ofWalletFactory
.
-
-
Constructor Summary
Constructors Constructor Description DefaultWalletFactory(KeyPairService keyPairService, AddressCodec addressCodec)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Wallet
fromKeyPair(KeyPair keyPair, boolean isTest)
Wallet
fromSeed(String seed, boolean isTest)
Generate aWallet
from a Base58Check encoded seed value.static WalletFactory
getInstance()
Get a JVM wideWalletFactory
instance.SeedWalletGenerationResult
randomWallet(boolean isTest)
Generate aWallet
by generating a random seed and deriving the public/private keys and XRPL address from it.
-
-
-
Constructor Detail
-
DefaultWalletFactory
public DefaultWalletFactory(KeyPairService keyPairService, AddressCodec addressCodec)
- Parameters:
keyPairService
- AKeyPairService
.addressCodec
- AnAddressCodec
.
-
-
Method Detail
-
getInstance
public static WalletFactory getInstance()
Get a JVM wideWalletFactory
instance.- Returns:
- A static
DefaultWalletFactory
instance.
-
randomWallet
public SeedWalletGenerationResult randomWallet(boolean isTest)
Description copied from interface:WalletFactory
Generate aWallet
by generating a random seed and deriving the public/private keys and XRPL address from it.- Specified by:
randomWallet
in interfaceWalletFactory
- Parameters:
isTest
- A boolean requesting either a testnet wallet (iftrue
) or a mainnet wallet (iffalse
).- Returns:
- A
SeedWalletGenerationResult
, which contains the seed that was generated, as well as theWallet
.
-
fromSeed
public Wallet fromSeed(String seed, boolean isTest)
Description copied from interface:WalletFactory
Generate aWallet
from a Base58Check encoded seed value.- Specified by:
fromSeed
in interfaceWalletFactory
- Parameters:
seed
- A Base58Check encoded 16 byte seed value.isTest
- A boolean indicating either a testnet wallet (iftrue
) or a mainnet wallet (iffalse
).- Returns:
- The
Wallet
derived from the seed.
-
fromKeyPair
public Wallet fromKeyPair(KeyPair keyPair, boolean isTest)
Description copied from interface:WalletFactory
- Specified by:
fromKeyPair
in interfaceWalletFactory
- Parameters:
keyPair
- TheKeyPair
containing the private and public keys used to generate theWallet
.isTest
- A boolean indicating either a testnet wallet (iftrue
) or a mainnet wallet (iffalse
).- Returns:
- The
Wallet
derived from the keyPair.
-
-