Class WalletUtils


  • public class WalletUtils
    extends Object
    Utils class to provide common tools and constants
    • Method Detail

      • getCurrentUserId

        public static final String getCurrentUserId()
      • getNotificationReceiversUsers

        public static List<String> getNotificationReceiversUsers​(Wallet wallet,
                                                                 String excludedId)
      • getPermanentLink

        public static String getPermanentLink​(Wallet wallet)
      • getIdentityById

        public static org.exoplatform.social.core.identity.model.Identity getIdentityById​(long identityId)
      • getIdentityById

        public static org.exoplatform.social.core.identity.model.Identity getIdentityById​(String identityId)
      • getIdentityByTypeAndId

        public static org.exoplatform.social.core.identity.model.Identity getIdentityByTypeAndId​(WalletType type,
                                                                                                 String remoteId)
      • getSpacePrettyName

        public static String getSpacePrettyName​(String id)
      • getSpace

        public static org.exoplatform.social.core.space.model.Space getSpace​(String id)
      • computeWalletIdentity

        public static void computeWalletIdentity​(Wallet wallet)
      • isUserRewardingAdmin

        public static final boolean isUserRewardingAdmin​(String username)
      • isUserMemberOfSpaceOrGroupOrUser

        public static final boolean isUserMemberOfSpaceOrGroupOrUser​(String username,
                                                                     String accessPermission)
      • isUserMemberOfGroupOrUser

        public static final boolean isUserMemberOfGroupOrUser​(String username,
                                                              String permissionExpression)
      • getWalletLink

        public static String getWalletLink​(String receiverType,
                                           String receiverId)
      • getMyWalletLink

        public static String getMyWalletLink()
      • getPermanentLink

        public static String getPermanentLink​(org.exoplatform.social.core.space.model.Space space)
      • encodeString

        public static String encodeString​(String content)
      • decodeString

        public static String decodeString​(String content)
      • isUserSpaceManager

        public static boolean isUserSpaceManager​(String id,
                                                 String modifier)
      • canAccessWallet

        public static boolean canAccessWallet​(Wallet wallet,
                                              String currentUser)
        Return true if user can access wallet detailed information
        Parameters:
        wallet - wallet details to check
        currentUser - user accessing wallet details
        Returns:
        true if has access, else false
      • isUserSpaceMember

        public static boolean isUserSpaceMember​(String spaceId,
                                                String accesssor)
      • computeWalletFromIdentity

        public static final void computeWalletFromIdentity​(Wallet wallet,
                                                           org.exoplatform.social.core.identity.model.Identity identity)
      • formatTransactionHash

        public static final String formatTransactionHash​(String transactionHash)
      • hideWalletOwnerPrivateInformation

        public static final void hideWalletOwnerPrivateInformation​(Wallet wallet)
      • fromJsonString

        public static final <T> T fromJsonString​(String value,
                                                 Class<T> resultClass)
      • toJsonString

        public static final String toJsonString​(Object object)
      • convertToDecimals

        public static final BigInteger convertToDecimals​(double amount,
                                                         int decimals)
      • convertFromDecimals

        public static final double convertFromDecimals​(BigInteger amount,
                                                       int decimals)
      • getGasLimit

        public static final Long getGasLimit()
      • getAdminGasPrice

        public static final Long getAdminGasPrice()
      • getContractDetail

        public static final ContractDetail getContractDetail()
      • getContractAddress

        public static final String getContractAddress()
      • getNetworkId

        public static final long getNetworkId()
      • getWebsocketURL

        public static final String getWebsocketURL()
      • hasKnownWalletInTransaction

        public static final boolean hasKnownWalletInTransaction​(TransactionDetail transactionDetail)
      • isWalletEmpty

        public static final boolean isWalletEmpty​(Wallet wallet)
      • isAdminAccount

        public static final boolean isAdminAccount​(String address)
      • getResourceBundleKey

        public static final String getResourceBundleKey​(Locale locale,
                                                        String key)
      • getLocale

        public static Locale getLocale​(Wallet wallet)
      • getUserLocale

        public static final Locale getUserLocale​(String username)
      • getBlockchainURLSuffix

        public static final String getBlockchainURLSuffix()
      • logStatistics

        public static final void logStatistics​(TransactionDetail transactionDetail)
      • getWalletService

        public static final WalletService getWalletService()
      • getSpaceService

        public static final org.exoplatform.social.core.space.spi.SpaceService getSpaceService()
      • formatBalance

        public static final String formatBalance​(double balance,
                                                 Locale locale,
                                                 boolean simplified)
        Format Wallet Balance amount in currency format, without currency symbol and switch user locale.
        Parameters:
        balance - amount to format
        locale - designated locale to display balance
        simplified - if true, the fractions will be ignored when the balance is greater than 100.
        Returns:
        formatted balance in user locale
      • getListenerService

        public static final org.exoplatform.services.listener.ListenerService getListenerService()