Interface StakingService


  • public interface StakingService
    Contract function call object for Staking
    Since:
    0.2.0
    Author:
    Alexandre Carvalho, Andre Bertolace
    • Method Detail

      • viewAccountTotalBalance

        FunctionCallResult<java.math.BigInteger> viewAccountTotalBalance​(NearClient nearClient,
                                                                         java.lang.String contractAccountId,
                                                                         java.lang.String accountId)
        Contract function view call to get the account total balance
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        accountId - the arguments for the view method
        Returns:
        a typed function call result
      • viewAccountStakedBalance

        FunctionCallResult<java.math.BigInteger> viewAccountStakedBalance​(NearClient nearClient,
                                                                          java.lang.String contractAccountId,
                                                                          java.lang.String accountId)
        Contract function view call to get the account staked balance
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        accountId - the arguments for the view method
        Returns:
        a typed function call result
      • viewAccountUnstakedBalance

        FunctionCallResult<java.math.BigInteger> viewAccountUnstakedBalance​(NearClient nearClient,
                                                                            java.lang.String contractAccountId,
                                                                            java.lang.String accountId)
        Contract function view call to get the account unstaked balance
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        accountId - the arguments for the view method
        Returns:
        a typed function call result
      • isAccountUnstakedBalanceAvailable

        FunctionCallResult<java.lang.Boolean> isAccountUnstakedBalanceAvailable​(NearClient nearClient,
                                                                                java.lang.String contractAccountId,
                                                                                java.lang.String accountId)
        Contract function view call to check if the account unstaked balance is available
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        accountId - the arguments for the view method
        Returns:
        a typed function call result
      • viewTotalStakedBalance

        FunctionCallResult<java.math.BigInteger> viewTotalStakedBalance​(NearClient nearClient,
                                                                        java.lang.String contractAccountId,
                                                                        java.lang.String accountId)
        Contract function view call to get the total staked balance
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        accountId - the arguments for the view method
        Returns:
        a typed function call result
      • viewOwnerId

        FunctionCallResult<java.lang.String> viewOwnerId​(NearClient nearClient,
                                                         java.lang.String contractAccountId,
                                                         java.lang.String accountId)
        Contract function view call to get the contract owner id
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        accountId - the arguments for the view method
        Returns:
        a typed function call result
      • viewRewardFeeFraction

        FunctionCallResult<RewardFee> viewRewardFeeFraction​(NearClient nearClient,
                                                            java.lang.String contractAccountId,
                                                            java.lang.String accountId)
        Returns the fee fraction charged by the staking farm (eg. x%)
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        accountId - the arguments for the view method
        Returns:
        a json node of the form {"numerator": numeric, "denominator": numeric}
      • viewFarms

        FunctionCallResult<com.fasterxml.jackson.databind.JsonNode> viewFarms​(NearClient nearClient,
                                                                              java.lang.String contractAccountId,
                                                                              java.lang.String accountId,
                                                                              java.lang.Long fromIndex,
                                                                              java.lang.Long limit)
        Returns the details for all farms for the given contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        accountId - the arguments for the view method
        fromIndex - starting index
        limit - limit
        Returns:
        json nodes of the form {"name": String, "token_id": String, "amount": numeric, "start_date":numeric, "end_date": numeric}
      • viewFarm

        FunctionCallResult<com.fasterxml.jackson.databind.JsonNode> viewFarm​(NearClient nearClient,
                                                                             java.lang.String contractAccountId,
                                                                             java.lang.String accountId,
                                                                             java.lang.Long farmId)
        Returns the detail for a specific farm the given farmId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        accountId - the arguments for the view method
        farmId - farm Id
        Returns:
        a json node of the form {"name": String, "token_id": String, "amount": numeric, "start_date":numeric, "end_date": numeric}
      • viewUnclaimedReward

        FunctionCallResult<java.math.BigInteger> viewUnclaimedReward​(NearClient nearClient,
                                                                     java.lang.String contractAccountId,
                                                                     java.lang.String accountId,
                                                                     java.lang.Long farmId)
        Returns the unclaimed reward in a given farmId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        accountId - the arguments for the view method
        farmId - farm Id
        Returns:
        the unclaimed reward
      • callDeposit

        TransactionAwait callDeposit​(NearClient nearClient,
                                     java.lang.String contractAccountId,
                                     java.math.BigInteger amount,
                                     java.lang.String accountId,
                                     PublicKey publicKey,
                                     PrivateKey privateKey)
        Synchronous contractCall to deposit an amount to the contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a TransactionAwait object
      • callDepositAsync

        EncodedHash callDepositAsync​(NearClient nearClient,
                                     java.lang.String contractAccountId,
                                     java.math.BigInteger amount,
                                     java.lang.String accountId,
                                     PublicKey publicKey,
                                     PrivateKey privateKey)
        Asynchronous contractCall to deposit an amount to the contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a EncodedHash object
      • callWithdraw

        TransactionAwait callWithdraw​(NearClient nearClient,
                                      java.lang.String contractAccountId,
                                      java.math.BigInteger amount,
                                      java.lang.String accountId,
                                      PublicKey publicKey,
                                      PrivateKey privateKey)
        Synchronous contractCall to withdraw an amount to the contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a TransactionAwait object
      • callWithdrawAsync

        EncodedHash callWithdrawAsync​(NearClient nearClient,
                                      java.lang.String contractAccountId,
                                      java.math.BigInteger amount,
                                      java.lang.String accountId,
                                      PublicKey publicKey,
                                      PrivateKey privateKey)
        Asynchronous contractCall to withdraw an amount to the contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a EncodedHash object
      • callStake

        TransactionAwait callStake​(NearClient nearClient,
                                   java.lang.String contractAccountId,
                                   java.math.BigInteger amount,
                                   java.lang.String accountId,
                                   PublicKey publicKey,
                                   PrivateKey privateKey)
        Synchronous contractCall to stake an amount to the contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a TransactionAwait object
      • callStakeAsync

        EncodedHash callStakeAsync​(NearClient nearClient,
                                   java.lang.String contractAccountId,
                                   java.math.BigInteger amount,
                                   java.lang.String accountId,
                                   PublicKey publicKey,
                                   PrivateKey privateKey)
        Asynchronous contractCall to stake an amount to the contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a EncodedHash object
      • callUnstake

        TransactionAwait callUnstake​(NearClient nearClient,
                                     java.lang.String contractAccountId,
                                     java.lang.String amount,
                                     java.lang.String accountId,
                                     PublicKey publicKey,
                                     PrivateKey privateKey)
        Synchronous contractCall to unstake an amount to the contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a TransactionAwait object
      • callUnstakeAsync

        EncodedHash callUnstakeAsync​(NearClient nearClient,
                                     java.lang.String contractAccountId,
                                     java.lang.String amount,
                                     java.lang.String accountId,
                                     PublicKey publicKey,
                                     PrivateKey privateKey)
        Asynchronous contractCall to unstake an amount to the contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a EncodedHash object
      • callDepositAndStake

        TransactionAwait callDepositAndStake​(NearClient nearClient,
                                             java.lang.String contractAccountId,
                                             java.math.BigInteger amount,
                                             java.lang.String accountId,
                                             PublicKey publicKey,
                                             PrivateKey privateKey)
        Synchronous contractCall to deposit and stake an amount to the contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a TransactionAwait object
      • callDepositAndStakeAsync

        EncodedHash callDepositAndStakeAsync​(NearClient nearClient,
                                             java.lang.String contractAccountId,
                                             java.math.BigInteger amount,
                                             java.lang.String accountId,
                                             PublicKey publicKey,
                                             PrivateKey privateKey)
        Asynchronous contractCall to deposit and stake an amount to the contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a EncodedHash object
      • callStakeAll

        TransactionAwait callStakeAll​(NearClient nearClient,
                                      java.lang.String contractAccountId,
                                      java.math.BigInteger amount,
                                      java.lang.String accountId,
                                      PublicKey publicKey,
                                      PrivateKey privateKey)
        Synchronous contractCall to stake all available balance in the contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a TransactionAwait object
      • callStakeAllAsync

        EncodedHash callStakeAllAsync​(NearClient nearClient,
                                      java.lang.String contractAccountId,
                                      java.math.BigInteger amount,
                                      java.lang.String accountId,
                                      PublicKey publicKey,
                                      PrivateKey privateKey)
        Asynchronous contractCall to stake all available balance in the contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a EncodedHash object
      • callClaim

        TransactionAwait callClaim​(NearClient nearClient,
                                   java.lang.String contractAccountId,
                                   java.math.BigInteger amount,
                                   java.lang.String accountId,
                                   PublicKey publicKey,
                                   PrivateKey privateKey)
        Synchronous contractCall to claim rewards from contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a TransactionAwait object
      • callClaimAsync

        EncodedHash callClaimAsync​(NearClient nearClient,
                                   java.lang.String contractAccountId,
                                   java.math.BigInteger amount,
                                   java.lang.String accountId,
                                   PublicKey publicKey,
                                   PrivateKey privateKey)
        Asynchronous contractCall to claim rewards from contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a EncodedHash object
      • callPing

        TransactionAwait callPing​(NearClient nearClient,
                                  java.lang.String contractAccountId,
                                  java.math.BigInteger amount,
                                  java.lang.String accountId,
                                  PublicKey publicKey,
                                  PrivateKey privateKey)
        Synchronous contractCall to ping contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a TransactionAwait object
      • callPingAsync

        EncodedHash callPingAsync​(NearClient nearClient,
                                  java.lang.String contractAccountId,
                                  java.math.BigInteger amount,
                                  java.lang.String accountId,
                                  PublicKey publicKey,
                                  PrivateKey privateKey)
        Asynchronous contractCall to ping contractAccountId
        Parameters:
        nearClient - the near service instance to use for the contract call
        contractAccountId - the contract's account id
        amount - amount to deposit
        accountId - the arguments for the view method
        publicKey - the arguments for the view method
        privateKey - the arguments for the view method
        Returns:
        a EncodedHash object