Package io.meeds.wallet.storage
Class WalletStorage
java.lang.Object
io.meeds.wallet.storage.WalletStorage
- Direct Known Subclasses:
CachedAccountStorage
-
Constructor Summary
ConstructorsConstructorDescriptionWalletStorage(WalletAccountDAO walletAccountDAO, WalletAccountBackupDAO walletAccountBackupDAO, WalletPrivateKeyDAO privateKeyDAO, WalletBlockchainStateDAO blockchainStateDAO, org.exoplatform.web.security.codec.CodecInitializer codecInitializer) -
Method Summary
Modifier and TypeMethodDescriptionSet<io.meeds.wallet.model.Wallet> findListByIdentityIds(List<Long> identityIds) Retrieves the list registered wallets identified by identities listio.meeds.wallet.model.WalletgetWalletByAddress(String address, String contractAddress) io.meeds.wallet.model.WalletgetWalletByIdentityId(long identityId, String contractAddress) getWalletPrivateKey(long walletId) Find Wallet encoded private key by wallet identifier.longbooleanhasWallet(long walletId) Checks whether identity has a wallet or notbooleanhasWalletBackup(long walletId) Checks whether identity has a wallet Backup or notSet<io.meeds.wallet.model.Wallet> Retrieves the list registered walletsio.meeds.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(io.meeds.wallet.model.Wallet wallet, String contractAddress) Get wallet blockchain state from internal databaseio.meeds.wallet.model.WalletsaveWallet(io.meeds.wallet.model.Wallet wallet, boolean isNew) io.meeds.wallet.model.WalletsaveWalletBackupState(long identityId, boolean backupState) Change wallet backup statevoidsaveWalletBlockchainState(io.meeds.wallet.model.Wallet wallet, String contractAddress) Save wallet state in blockchainvoidsaveWalletPrivateKey(long walletId, String content) Save wallet private keyvoidswitchToInternalWallet(long walletId) SwitchesWalletto internal provider and transaction signervoidswitchToWalletProvider(long walletId, io.meeds.wallet.model.WalletProvider provider, String newAddress) SwitchesWalletto a new wallet provider and transaction signer
-
Constructor Details
-
WalletStorage
public WalletStorage(WalletAccountDAO walletAccountDAO, WalletAccountBackupDAO walletAccountBackupDAO, WalletPrivateKeyDAO privateKeyDAO, WalletBlockchainStateDAO blockchainStateDAO, org.exoplatform.web.security.codec.CodecInitializer codecInitializer)
-
-
Method Details
-
listWallets
Retrieves the list registered wallets- Returns:
SetofWalletdetails with associated addresses
-
findListByIdentityIds
Retrieves the list registered wallets identified by identities list- Returns:
SetofWalletdetails with associated addresses
-
getWalletsCount
public long getWalletsCount()- Returns:
- associated wallets counts
-
getWalletByIdentityId
- Parameters:
identityId- user/space technical identty idcontractAddress- contract address to use for wallet blockchain state- Returns:
Walletdetails for identity
-
getWalletByAddress
- Parameters:
address- wallet addresscontractAddress- contract address to use for wallet blockchain state- Returns:
Walletdetails identified by address
-
retrieveWalletBlockchainState
public void retrieveWalletBlockchainState(io.meeds.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 io.meeds.wallet.model.Wallet saveWallet(io.meeds.wallet.model.Wallet wallet, boolean isNew) throws io.meeds.wallet.model.AddressAlreadyInUseException - Parameters:
wallet- wallet details to saveisNew- whether this is a new wallet association or not- Returns:
- saved wallet entity
- Throws:
io.meeds.wallet.model.AddressAlreadyInUseException- when the address is already used by another wallet
-
saveWalletBackupState
public io.meeds.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 io.meeds.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
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
Save wallet private key- Parameters:
walletId- wallet unique identifier that is equals to identity IDcontent- private key content
-
saveWalletBlockchainState
Save wallet state in blockchain- Parameters:
wallet- wallet to save its statecontractAddress- address of the contract on which the state is associated
-
hasWalletBackup
public boolean hasWalletBackup(long walletId) Checks whether identity has a wallet Backup or not- Parameters:
walletId-Walletunique identifier- Returns:
- true if an internal wallet address is backed up, else return false
-
hasWallet
public boolean hasWallet(long walletId) Checks whether identity has a wallet or not- Parameters:
walletId-Walletunique identifier- Returns:
- true if wallet exists for selected identity
-
switchToInternalWallet
public void switchToInternalWallet(long walletId) SwitchesWalletto internal provider and transaction signer- Parameters:
walletId-Walletunique identifier
-
switchToWalletProvider
public void switchToWalletProvider(long walletId, io.meeds.wallet.model.WalletProvider provider, String newAddress) SwitchesWalletto a new wallet provider and transaction signer- Parameters:
walletId-Walletunique identifierprovider-WalletProviderthat must be different from Internal WalletnewAddress- Selected address provided from new Wallet Provider Tool
-