Interface StakingService
-
public interface StakingService
Contract function call object for Staking- Since:
- 0.2.0
- Author:
- Alexandre Carvalho, Andre Bertolace
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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 contractAccountIdEncodedHash
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 contractAccountIdTransactionAwait
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 contractAccountIdTransactionAwait
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 contractAccountIdEncodedHash
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 contractAccountIdEncodedHash
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 contractAccountIdTransactionAwait
callPing(NearClient nearClient, java.lang.String contractAccountId, java.math.BigInteger amount, java.lang.String accountId, PublicKey publicKey, PrivateKey privateKey)
Synchronous contractCall to ping contractAccountIdEncodedHash
callPingAsync(NearClient nearClient, java.lang.String contractAccountId, java.math.BigInteger amount, java.lang.String accountId, PublicKey publicKey, PrivateKey privateKey)
Asynchronous contractCall to ping contractAccountIdTransactionAwait
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 contractAccountIdTransactionAwait
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 contractAccountIdEncodedHash
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 contractAccountIdEncodedHash
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 contractAccountIdTransactionAwait
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 contractAccountIdEncodedHash
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 contractAccountIdTransactionAwait
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 contractAccountIdEncodedHash
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 contractAccountIdFunctionCallResult<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 availableFunctionCallResult<java.math.BigInteger>
viewAccountStakedBalance(NearClient nearClient, java.lang.String contractAccountId, java.lang.String accountId)
Contract function view call to get the account staked balanceFunctionCallResult<java.math.BigInteger>
viewAccountTotalBalance(NearClient nearClient, java.lang.String contractAccountId, java.lang.String accountId)
Contract function view call to get the account total balanceFunctionCallResult<java.math.BigInteger>
viewAccountUnstakedBalance(NearClient nearClient, java.lang.String contractAccountId, java.lang.String accountId)
Contract function view call to get the account unstaked balanceFunctionCallResult<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 farmIdFunctionCallResult<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 contractAccountIdFunctionCallResult<java.lang.String>
viewOwnerId(NearClient nearClient, java.lang.String contractAccountId, java.lang.String accountId)
Contract function view call to get the contract owner idFunctionCallResult<RewardFee>
viewRewardFeeFraction(NearClient nearClient, java.lang.String contractAccountId, java.lang.String accountId)
Returns the fee fraction charged by the staking farm (eg.FunctionCallResult<java.math.BigInteger>
viewTotalStakedBalance(NearClient nearClient, java.lang.String contractAccountId, java.lang.String accountId)
Contract function view call to get the total staked balanceFunctionCallResult<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
-
-
-
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 callcontractAccountId
- the contract's account idaccountId
- 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 callcontractAccountId
- the contract's account idaccountId
- 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 callcontractAccountId
- the contract's account idaccountId
- 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 callcontractAccountId
- the contract's account idaccountId
- 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 callcontractAccountId
- the contract's account idaccountId
- 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 callcontractAccountId
- the contract's account idaccountId
- 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 callcontractAccountId
- the contract's account idaccountId
- 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 callcontractAccountId
- the contract's account idaccountId
- the arguments for the view methodfromIndex
- starting indexlimit
- 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 callcontractAccountId
- the contract's account idaccountId
- the arguments for the view methodfarmId
- 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 callcontractAccountId
- the contract's account idaccountId
- the arguments for the view methodfarmId
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- 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 callcontractAccountId
- the contract's account idamount
- amount to depositaccountId
- the arguments for the view methodpublicKey
- the arguments for the view methodprivateKey
- the arguments for the view method- Returns:
- a EncodedHash object
-
-