/** * <code>repeated .com.openwallet.core.protos.WalletPocket pockets = 6;</code> */ public Builder addPockets( com.openwallet.core.protos.Protos.WalletPocket.Builder builderForValue) { if (pocketsBuilder_ == null) { ensurePocketsIsMutable(); pockets_.add(builderForValue.build()); onChanged(); } else { pocketsBuilder_.addMessage(builderForValue.build()); } return this; } /**
private static Protos.Wallet updateV2toV3Proto(Protos.Wallet walletProto) { checkState(walletProto.getVersion() < 3, "Can update only from version < 3"); Protos.Wallet.Builder b = walletProto.toBuilder(); for (int i = 0; i < b.getPocketsCount(); i++) { Protos.WalletPocket.Builder account = b.getPocketsBuilder(i); // pre v2 wallets were saving the coin name in the description account.clearDescription(); } return b.build(); }
public static Protos.WalletPocket toProtobuf(WalletPocketHD pocket) { walletBuilder.setNetworkIdentifier(pocket.getCoinType().getId()); if (pocket.getDescription() != null) { walletBuilder.setDescription(pocket.getDescription()); walletBuilder.setId(pocket.getId()); addressStatus.setStatus(status.getStatus()); walletBuilder.addAddressStatus(addressStatus.build()); walletBuilder.addTransaction(txProto); walletBuilder.addUnspentOutput(utxoProto); walletBuilder.addAllKey(pocket.serializeKeychainToProtobuf()); walletBuilder.setLastSeenBlockHash(hashToByteString(pocket.getLastBlockSeenHash())); walletBuilder.setLastSeenBlockHeight(pocket.getLastBlockSeenHeight()); walletBuilder.setLastSeenBlockTimeSecs(pocket.getLastBlockSeenTimeSecs()); return walletBuilder.build();
private static Protos.Wallet updateV1toV2Proto(Protos.Wallet walletProto) { checkState(walletProto.getVersion() < 2, "Can update only from version < 2"); // Purge blockchain data if wallet is bigger than 2mb boolean purgeBlockchain = walletProto.getSerializedSize() > 200000; Protos.Wallet.Builder b = walletProto.toBuilder(); for (int i = 0; i < b.getPocketsCount(); i++) { Protos.WalletPocket.Builder account = b.getPocketsBuilder(i); // Purge blockchain data if needed if (purgeBlockchain) { account.clearAddressStatus(); account.clearLastSeenBlockHash(); account.clearLastSeenBlockHeight(); account.clearLastSeenBlockTimeSecs(); account.clearTransaction(); } // Update coin type ids if (account.getNetworkIdentifier().equals("dogecoindark.main")) { account.setNetworkIdentifier("verge.main"); b.setPockets(i, account); } if (account.getNetworkIdentifier().equals("darkcoin.main")) { account.setNetworkIdentifier("dash.main"); b.setPockets(i, account); } } return b.build(); }
public static Protos.WalletPocket toProtobuf(NxtFamilyWallet account) { Protos.WalletPocket.Builder walletBuilder = Protos.WalletPocket.newBuilder(); walletBuilder.setNetworkIdentifier(account.getCoinType().getId()); if (account.getDescription() != null) { walletBuilder.setDescription(account.getDescription()); } if (account.getId() != null) { walletBuilder.setId(account.getId()); } // for (WalletTransaction wtx : account.getWalletTransactions()) { // Protos.Transaction txProto = makeTxProto(wtx); // walletBuilder.addTransaction(txProto); // } walletBuilder.addAllKey(account.serializeKeychainToProtobuf()); // Populate the lastSeenBlockHash field. // if (account.getLastBlockSeenHash() != null) { // walletBuilder.setLastSeenBlockHash(hashToByteString(account.getLastBlockSeenHash())); // walletBuilder.setLastSeenBlockHeight(account.getLastBlockSeenHeight()); // } // if (account.getLastBlockSeenTimeSecs() > 0) { // walletBuilder.setLastSeenBlockTimeSecs(account.getLastBlockSeenTimeSecs()); // } return walletBuilder.build(); }
private static Builder create() { return new Builder(); }
/** * <code>repeated .com.openwallet.core.protos.WalletPocket pockets = 6;</code> */ public Builder setPockets( int index, com.openwallet.core.protos.Protos.WalletPocket.Builder builderForValue) { if (pocketsBuilder_ == null) { ensurePocketsIsMutable(); pockets_.set(index, builderForValue.build()); onChanged(); } else { pocketsBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
public Builder clone() { return create().mergeFrom(buildPartial()); }
/** * <code>repeated .com.openwallet.core.protos.WalletPocket pockets = 6;</code> */ public Builder addPockets( int index, com.openwallet.core.protos.Protos.WalletPocket.Builder builderForValue) { if (pocketsBuilder_ == null) { ensurePocketsIsMutable(); pockets_.add(index, builderForValue.build()); onChanged(); } else { pocketsBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
public com.openwallet.core.protos.Protos.WalletPocket build() { com.openwallet.core.protos.Protos.WalletPocket result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /**