MCPcopy Index your code
hub / github.com/ccxt/ccxt / encodeData

Method encodeData

java/lib/src/main/java/io/github/ccxt/Exchange.java:2541–2557  ·  view source on GitHub ↗
(String primaryType, Map<String, Object> data, Map<String, List<Map<String, String>>> types)

Source from the content-addressed store, hash-verified

2539 }
2540
2541 private static byte[] encodeData(String primaryType, Map<String, Object> data, Map<String, List<Map<String, String>>> types) {
2542 List<byte[]> chunks = new ArrayList<>();
2543 for (Map<String, String> field : types.get(primaryType)) {
2544 String fieldName = field.get("name");
2545 String fieldType = field.get("type");
2546 chunks.add(encodeValue(fieldType, data.get(fieldName), types));
2547 }
2548 int total = 0;
2549 for (byte[] c : chunks) total += c.length;
2550 byte[] out = new byte[total];
2551 int pos = 0;
2552 for (byte[] c : chunks) {
2553 System.arraycopy(c, 0, out, pos, c.length);
2554 pos += c.length;
2555 }
2556 return out;
2557 }
2558
2559 @SuppressWarnings("unchecked")
2560 private static byte[] encodeValue(String type, Object value, Map<String, List<Map<String, String>>> types) {

Callers 1

hashStructMethod · 0.95

Calls 3

encodeValueMethod · 0.95
getMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected