Package org.exoplatform.wallet.storage
Class WalletStorage
- java.lang.Object
-
- org.exoplatform.wallet.storage.WalletStorage
-
- Direct Known Subclasses:
CachedAccountStorage
public class WalletStorage extends Object
-
-
Constructor Summary
Constructors Constructor Description WalletStorage(WalletAccountDAO walletAccountDAO, WalletPrivateKeyDAO privateKeyDAO, WalletBlockchainStateDAO blockchainStateDAO, org.exoplatform.web.security.codec.CodecInitializer codecInitializer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.exoplatform.wallet.model.WalletgetWalletByAddress(String address, String contractAddress)org.exoplatform.wallet.model.WalletgetWalletByIdentityId(long identityId, String contractAddress)StringgetWalletPrivateKey(long walletId)Find Wallet encoded private key by wallet identifier.longgetWalletsCount()Set<org.exoplatform.wallet.model.Wallet>listWallets()Retrieves the list registered walletsorg.exoplatform.wallet.model.WalletremoveWallet(long identityId)Removes a wallet identitied by user/space identity technical idvoidremoveWalletPrivateKey(long walletId)Remove Wallet encoded private key by wallet identifiervoidretrieveWalletBlockchainState(org.exoplatform.wallet.model.Wallet wallet, String contractAddress)Get wallet blockchain state from internal databaseorg.exoplatform.wallet.model.WalletsaveWallet(org.exoplatform.wallet.model.Wallet wallet, boolean isNew)org.exoplatform.wallet.model.WalletsaveWalletBackupState(long identityId, boolean backupState)Change wallet backup statevoidsaveWalletBlockchainState(org.exoplatform.wallet.model.Wallet wallet, String contractAddress)Save wallet state in blockchainvoidsaveWalletPrivateKey(long walletId, String content)Save wallet private key
-
-
-
Constructor Detail
-
WalletStorage
public WalletStorage(WalletAccountDAO walletAccountDAO, WalletPrivateKeyDAO privateKeyDAO, WalletBlockchainStateDAO blockchainStateDAO, org.exoplatform.web.security.codec.CodecInitializer codecInitializer)
-
-
Method Detail
-
listWallets
public Set<org.exoplatform.wallet.model.Wallet> listWallets()
Retrieves the list registered wallets- Returns:
SetofWalletdetails with associated addresses
-
getWalletsCount
public long getWalletsCount()
- Returns:
- associated wallets counts
-
getWalletByIdentityId
public org.exoplatform.wallet.model.Wallet getWalletByIdentityId(long identityId, String contractAddress)- Parameters:
identityId- user/space technical identty idcontractAddress- contract address to use for wallet blockchain state- Returns:
Walletdetails for identity
-
getWalletByAddress
public org.exoplatform.wallet.model.Wallet getWalletByAddress(String address, String contractAddress)
- Parameters:
address- wallet addresscontractAddress- contract address to use for wallet blockchain state- Returns:
Walletdetails identified by address
-
retrieveWalletBlockchainState
public void retrieveWalletBlockchainState(org.exoplatform.wallet.model.Wallet wallet, String contractAddress)Get wallet blockchain state from internal database- Parameters:
wallet- object to refreshcontractAddress- contract address to use for wallet blockchain state
-
saveWallet
public org.exoplatform.wallet.model.Wallet saveWallet(org.exoplatform.wallet.model.Wallet wallet, boolean isNew)- Parameters:
wallet- wallet details to saveisNew- whether this is a new wallet association or not- Returns:
- saved wallet entity
-
saveWalletBackupState
public org.exoplatform.wallet.model.Wallet saveWalletBackupState(long identityId, boolean backupState)Change wallet backup state- Parameters:
identityId- user/space technical identty idbackupState- true if backedUp else false- Returns:
- modified
Wallet
-
removeWallet
public org.exoplatform.wallet.model.Wallet removeWallet(long identityId)
Removes a wallet identitied by user/space identity technical id- Parameters:
identityId- user/space technical identty id- Returns:
- removed
Wallet
-
getWalletPrivateKey
public String getWalletPrivateKey(long walletId)
Find Wallet encoded private key by wallet identifier.- Parameters:
walletId- wallet unique identifier that is equals to identity ID- Returns:
- private key encoded content
-
removeWalletPrivateKey
public void removeWalletPrivateKey(long walletId)
Remove Wallet encoded private key by wallet identifier- Parameters:
walletId- wallet unique identifier that is equals to identity ID
-
saveWalletPrivateKey
public void saveWalletPrivateKey(long walletId, String content)Save wallet private key- Parameters:
walletId- wallet unique identifier that is equals to identity IDcontent- private key content
-
saveWalletBlockchainState
public void saveWalletBlockchainState(org.exoplatform.wallet.model.Wallet wallet, String contractAddress)Save wallet state in blockchain- Parameters:
wallet- wallet to save its statecontractAddress- address of the contract on which the state is associated
-
-