Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ public void testInvalidAddress() {
UnsupportedOperationException.class,
() ->
new Address(
"0xa04462684b510796c186d19abfa6929742f79394583d6efb1243bbb473f21d9f"));
"0xa044321313121362684b510796c186d19abfa6929742f79394583d6efb1243bbb473f21d9f"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.fisco.bcos.sdk.contract.precompiled.callback.PrecompiledCallback;
import org.fisco.bcos.sdk.contract.precompiled.crud.common.Condition;
import org.fisco.bcos.sdk.contract.precompiled.crud.common.Entry;
import org.fisco.bcos.sdk.contract.precompiled.model.PrecompiledAddress;
import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.model.PrecompiledConstant;
import org.fisco.bcos.sdk.model.PrecompiledRetCode;
Expand All @@ -35,32 +34,40 @@
import org.fisco.bcos.sdk.transaction.model.exception.ContractException;
import org.fisco.bcos.sdk.utils.StringUtils;

/** This class not support in FISCO BCOS 3.0.0 rc1 Do not use it. */
@Deprecated
public class TableCRUDService {
private final Client client;
private final TablePrecompiled tablePrecompiled;
private static final String ValueFieldsDelimiter = ",";

@Deprecated
public TableCRUDService(Client client, CryptoKeyPair credential) {
this.client = client;
this.tablePrecompiled =
TablePrecompiled.load(
client.isWASM()
? PrecompiledAddress.TABLEFACTORY_PRECOMPILED_NAME
: PrecompiledAddress.TABLEFACTORY_PRECOMPILED_ADDRESS,
client,
credential);
this.client = null;
this.tablePrecompiled = null;
// this.client = client;
// this.tablePrecompiled =
// TablePrecompiled.load(
// client.isWASM()
// ? PrecompiledAddress.TABLEFACTORY_PRECOMPILED_NAME
// : PrecompiledAddress.TABLEFACTORY_PRECOMPILED_ADDRESS,
// client,
// credential);
}

@Deprecated
public static String convertValueFieldsToString(List<String> valueFields) {
return StringUtils.join(valueFields, ValueFieldsDelimiter);
}

@Deprecated
public void checkKey(String key) throws ContractException {
if (key.length() > PrecompiledConstant.TABLE_KEY_MAX_LENGTH) {
throw new ContractException(PrecompiledRetCode.OVER_TABLE_KEY_LENGTH_LIMIT);
}
}

@Deprecated
public RetCode createTable(String tableName, String keyFieldName, List<String> valueFields)
throws ContractException {
checkKey(keyFieldName);
Expand All @@ -69,11 +76,13 @@ public RetCode createTable(String tableName, String keyFieldName, List<String> v
tablePrecompiled.createTable(tableName, keyFieldName, valueFieldsString));
}

@Deprecated
public RetCode insert(String tableName, Entry fieldNameToValue) throws ContractException {
return ReceiptParser.parseTransactionReceipt(
tablePrecompiled.insert(tableName, fieldNameToValue.getTablePrecompiledEntry()));
}

@Deprecated
public RetCode update(String tableName, Entry fieldNameToValue, Condition condition)
throws ContractException {
return ReceiptParser.parseTransactionReceipt(
Expand All @@ -83,11 +92,13 @@ public RetCode update(String tableName, Entry fieldNameToValue, Condition condit
condition.getTableCondition()));
}

@Deprecated
public RetCode remove(String tableName, Condition condition) throws ContractException {
return ReceiptParser.parseTransactionReceipt(
tablePrecompiled.remove(tableName, condition.getTableCondition()));
}

@Deprecated
public List<Map<String, String>> select(String tableName, Condition condition)
throws ContractException {
try {
Expand All @@ -106,6 +117,7 @@ public List<Map<String, String>> select(String tableName, Condition condition)
}
}

@Deprecated
public static List<Map<String, String>> parseSelectResult(
List<TablePrecompiled.Entry> selectResult) throws JsonProcessingException {
List<Map<String, String>> result = new ArrayList<>();
Expand All @@ -130,6 +142,7 @@ private List<Map<String, String>> getTableDesc(String tableName) throws Contract
return tableDescList;
}

@Deprecated
public List<Map<String, String>> desc(String tableName) throws ContractException {
try {
return getTableDesc(tableName);
Expand All @@ -138,6 +151,7 @@ public List<Map<String, String>> desc(String tableName) throws ContractException
}
}

@Deprecated
private TransactionCallback createTransactionCallback(PrecompiledCallback callback) {
return new TransactionCallback() {
@Override
Expand All @@ -156,12 +170,14 @@ public void onResponse(TransactionReceipt receipt) {
};
}

@Deprecated
public void asyncInsert(String tableName, Entry entry, PrecompiledCallback callback)
throws ContractException {
this.tablePrecompiled.insert(
tableName, entry.getTablePrecompiledEntry(), createTransactionCallback(callback));
}

@Deprecated
public void asyncUpdate(
String tableName, Entry entry, Condition condition, PrecompiledCallback callback)
throws ContractException {
Expand All @@ -172,6 +188,7 @@ public void asyncUpdate(
createTransactionCallback(callback));
}

@Deprecated
public void asyncRemove(String tableName, Condition condition, PrecompiledCallback callback)
throws ContractException {
this.tablePrecompiled.remove(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import org.fisco.bcos.sdk.model.callback.TransactionCallback;
import org.fisco.bcos.sdk.transaction.model.exception.ContractException;

/** This class not support in FISCO BCOS 3.0.0 rc1 Do not use it. */
@Deprecated
@SuppressWarnings("unchecked")
public class TablePrecompiled extends Contract {
public static final String[] BINARY_ARRAY = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Map;
import org.fisco.bcos.sdk.contract.precompiled.crud.TablePrecompiled;

@Deprecated
public class Condition {

private Map<String, Map<ConditionOperator, String>> conditions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import java.math.BigInteger;

@Deprecated
public enum ConditionOperator {
eq(0),
ne(1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Map;
import org.fisco.bcos.sdk.contract.precompiled.crud.TablePrecompiled;

@Deprecated
public class Entry {
private Map<String, String> fieldNameToValue = new HashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
public class PrecompiledAddress {
public static final String SYSCONFIG_PRECOMPILED_ADDRESS =
"0000000000000000000000000000000000001000";

@Deprecated
public static final String TABLEFACTORY_PRECOMPILED_ADDRESS =
"0000000000000000000000000000000000001001";

public static final String CONSENSUS_PRECOMPILED_ADDRESS =
"0000000000000000000000000000000000001003";
public static final String CNS_PRECOMPILED_ADDRESS = "0000000000000000000000000000000000001004";
Expand All @@ -28,10 +31,10 @@ public class PrecompiledAddress {
public static final String CONTRACT_AUTH_ADDRESS = "0000000000000000000000000000000000001005";

public static final String SYSCONFIG_PRECOMPILED_NAME = "/sys/status";
public static final String TABLEFACTORY_PRECOMPILED_NAME = "/sys/table_storage";
public static final String CONSENSUS_PRECOMPILED_NAME = "/sys/consensus";
public static final String CNS_PRECOMPILED_NAME = "/sys/cns";
public static final String BFS_PRECOMPILED_NAME = "/sys/bfs";
@Deprecated public static final String TABLEFACTORY_PRECOMPILED_NAME = "/sys/table_storage";

private PrecompiledAddress() {}
}