public JObject GetWithdrawStakeTransaction(JObject opts) { var from = opts["from"]?.ToString().HexToBytes().ToUInt160() ?? throw new Exception($"\"from\" {opts["from"]} is not valid"); var validatorPubKey = opts["validatorPublicKey"]?.ToString().HexToBytes() ?? throw new Exception($"\"validatorPublicKey\" {opts["validatorPublicKey"]} is not valid"); var tx = _transactionBuilder.InvokeTransaction( from, ContractRegisterer.StakingContract, Money.Zero, StakingInterface.MethodWithdrawStake, validatorPubKey ); return(Web3DataFormatUtils.Web3UnsignedTransaction(tx, true)); }
public JObject GetStakeTransaction(JObject opts) { var staker = opts["stakerAddress"]?.ToString().HexToBytes().ToUInt160() ?? throw new Exception($"\"stakerAddress\" {opts["stakerAddress"]} is not valid"); var validatorPubKey = opts["validatorPublicKey"]?.ToString().HexToBytes() ?? throw new Exception($"\"validatorPublicKey\" {opts["validatorPublicKey"]} is not valid"); var stakeAmount = Money.Parse(opts["stakeAmount"]?.ToString() ?? throw new Exception($"\"stakeAmount\" {opts["stakeAmount"]} is not valid") ); var tx = _transactionBuilder.InvokeTransaction( staker, ContractRegisterer.StakingContract, Money.Zero, StakingInterface.MethodBecomeStaker, validatorPubKey, (object)stakeAmount.ToUInt256() ); return(Web3DataFormatUtils.Web3UnsignedTransaction(tx, true)); }