Search in sources :

Example 21 with Any

use of com.google.protobuf2.Any in project cosmostation-android by cosmostation.

the class Signer method getKavaIncentiveAllMsg.

public static ArrayList<Any> getKavaIncentiveAllMsg(String sender, String multiplier_name, BaseData baseData) {
    ArrayList<Any> msgAnys = new ArrayList<>();
    IncentiveReward incentiveRewards = baseData.mIncentiveRewards;
    if (incentiveRewards.getMintingRewardAmount().compareTo(BigDecimal.ZERO) > 0) {
        msgAnys.add(getKavaIncentiveUSDXMinting(sender, multiplier_name));
    }
    if (incentiveRewards.getHardRewardDenoms().size() > 0) {
        ArrayList<kava.incentive.v1beta1.Tx.Selection> denoms_to_claims = new ArrayList<>();
        for (String denom : incentiveRewards.getHardRewardDenoms()) {
            denoms_to_claims.add(kava.incentive.v1beta1.Tx.Selection.newBuilder().setDenom(denom).setMultiplierName(multiplier_name).build());
        }
        msgAnys.add(getKavaIncentiveHard(sender, denoms_to_claims));
    }
    if (incentiveRewards.getDelegatorRewardDenoms().size() > 0) {
        ArrayList<kava.incentive.v1beta1.Tx.Selection> denoms_to_claims = new ArrayList<>();
        for (String denom : incentiveRewards.getDelegatorRewardDenoms()) {
            denoms_to_claims.add(kava.incentive.v1beta1.Tx.Selection.newBuilder().setDenom(denom).setMultiplierName(multiplier_name).build());
        }
        msgAnys.add(getKavaIncentiveDelegator(sender, denoms_to_claims));
    }
    if (incentiveRewards.getSwapRewardDenoms().size() > 0) {
        ArrayList<kava.incentive.v1beta1.Tx.Selection> denoms_to_claims = new ArrayList<>();
        for (String denom : incentiveRewards.getSwapRewardDenoms()) {
            denoms_to_claims.add(kava.incentive.v1beta1.Tx.Selection.newBuilder().setDenom(denom).setMultiplierName(multiplier_name).build());
        }
        msgAnys.add(getKavaIncentiveSwap(sender, denoms_to_claims));
    }
    return msgAnys;
}
Also used : ArrayList(java.util.ArrayList) IncentiveReward(wannabit.io.cosmostaion.model.kava.IncentiveReward) ByteString(com.google.protobuf.ByteString) Any(com.google.protobuf2.Any)

Example 22 with Any

use of com.google.protobuf2.Any in project cosmostation-android by cosmostation.

the class Signer method getGrpcSignerInfo.

public static TxOuterClass.SignerInfo getGrpcSignerInfo(QueryOuterClass.QueryAccountResponse auth, ECKey pKey) {
    Any pubKey = WKey.generateGrpcPubKeyFromPriv(auth, pKey.getPrivateKeyAsHex());
    TxOuterClass.ModeInfo.Single singleMode = TxOuterClass.ModeInfo.Single.newBuilder().setMode(SIGN_MODE_DIRECT).build();
    TxOuterClass.ModeInfo modeInfo = TxOuterClass.ModeInfo.newBuilder().setSingle(singleMode).build();
    return TxOuterClass.SignerInfo.newBuilder().setPublicKey(pubKey).setModeInfo(modeInfo).setSequence(onParseSequenceNumber(auth)).build();
}
Also used : TxOuterClass(cosmos.tx.v1beta1.TxOuterClass) Any(com.google.protobuf2.Any)

Example 23 with Any

use of com.google.protobuf2.Any in project cosmostation-android by cosmostation.

the class Signer method getKavaIncentiveDelegator.

public static Any getKavaIncentiveDelegator(String sender, ArrayList<kava.incentive.v1beta1.Tx.Selection> denoms_to_claims) {
    kava.incentive.v1beta1.Tx.MsgClaimDelegatorReward msgClaimDelegatorReward = kava.incentive.v1beta1.Tx.MsgClaimDelegatorReward.newBuilder().setSender(sender).addAllDenomsToClaim(denoms_to_claims).build();
    Any msgKavaClaimDelegateAny = Any.newBuilder().setTypeUrl("/kava.incentive.v1beta1.MsgClaimDelegatorReward").setValue(msgClaimDelegatorReward.toByteString()).build();
    return msgKavaClaimDelegateAny;
}
Also used : Tx(cosmos.gov.v1beta1.Tx) Any(com.google.protobuf2.Any)

Example 24 with Any

use of com.google.protobuf2.Any in project cosmostation-android by cosmostation.

the class Signer method getBeginUnbondingMsg.

public static ArrayList<Any> getBeginUnbondingMsg(QueryOuterClass.QueryAccountResponse auth, ArrayList<Long> ids) {
    ArrayList<Any> msgAnys = new ArrayList<>();
    for (Long id : ids) {
        osmosis.lockup.Tx.MsgBeginUnlocking msgBeginUnlocking = osmosis.lockup.Tx.MsgBeginUnlocking.newBuilder().setOwner(onParseAddress(auth)).setID(id).build();
        Any msgBeginUnbondingAny = Any.newBuilder().setTypeUrl("/osmosis.lockup.MsgBeginUnlocking").setValue(msgBeginUnlocking.toByteString()).build();
        msgAnys.add(msgBeginUnbondingAny);
    }
    return msgAnys;
}
Also used : Tx(cosmos.gov.v1beta1.Tx) ArrayList(java.util.ArrayList) Any(com.google.protobuf2.Any)

Example 25 with Any

use of com.google.protobuf2.Any in project cosmostation-android by cosmostation.

the class Signer method getReInvestMsg.

public static ArrayList<Any> getReInvestMsg(QueryOuterClass.QueryAccountResponse auth, String valAddress, Coin amounts) {
    ArrayList<Any> msgsAny = new ArrayList<>();
    cosmos.distribution.v1beta1.Tx.MsgWithdrawDelegatorReward msgClaimReward = cosmos.distribution.v1beta1.Tx.MsgWithdrawDelegatorReward.newBuilder().setDelegatorAddress(onParseAddress(auth)).setValidatorAddress(valAddress).build();
    Any msgClaimRewardAny = Any.newBuilder().setTypeUrl("/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward").setValue(msgClaimReward.toByteString()).build();
    msgsAny.add(msgClaimRewardAny);
    CoinOuterClass.Coin toReinvsetCoin = CoinOuterClass.Coin.newBuilder().setAmount(amounts.amount).setDenom(amounts.denom).build();
    cosmos.staking.v1beta1.Tx.MsgDelegate msgDelegate = cosmos.staking.v1beta1.Tx.MsgDelegate.newBuilder().setDelegatorAddress(onParseAddress(auth)).setValidatorAddress(valAddress).setAmount(toReinvsetCoin).build();
    Any msgDelegateAny = Any.newBuilder().setTypeUrl("/cosmos.staking.v1beta1.MsgDelegate").setValue(msgDelegate.toByteString()).build();
    msgsAny.add(msgDelegateAny);
    return msgsAny;
}
Also used : Tx(cosmos.gov.v1beta1.Tx) ArrayList(java.util.ArrayList) CoinOuterClass(cosmos.base.v1beta1.CoinOuterClass) Any(com.google.protobuf2.Any)

Aggregations

Any (com.google.protobuf2.Any)17 ANY (org.mozilla.jss.asn1.ANY)16 ArrayList (java.util.ArrayList)13 Tx (cosmos.gov.v1beta1.Tx)11 SET (org.mozilla.jss.asn1.SET)9 InvalidBERException (org.mozilla.jss.asn1.InvalidBERException)8 SEQUENCE (org.mozilla.jss.asn1.SEQUENCE)8 OCTET_STRING (org.mozilla.jss.asn1.OCTET_STRING)7 Attribute (org.mozilla.jss.pkix.primitive.Attribute)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 ASN1Value (org.mozilla.jss.asn1.ASN1Value)6 BMPString (org.mozilla.jss.asn1.BMPString)6 DerOutputStream (org.mozilla.jss.netscape.security.util.DerOutputStream)5 ByteString (com.google.protobuf.ByteString)4 CoinOuterClass (cosmos.base.v1beta1.CoinOuterClass)4 OBJECT_IDENTIFIER (org.mozilla.jss.asn1.OBJECT_IDENTIFIER)4 CryptoToken (org.mozilla.jss.crypto.CryptoToken)4 BufferedInputStream (java.io.BufferedInputStream)3 FileInputStream (java.io.FileInputStream)3 IOException (java.io.IOException)3