(Object data)
| 2658 | } |
| 2659 | |
| 2660 | public Object packb(Object data) { |
| 2661 | try (java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream(); |
| 2662 | org.msgpack.core.MessagePacker packer = org.msgpack.core.MessagePack.newDefaultPacker(out)) { |
| 2663 | // Java Maps don't preserve insertion order, but msgpack signatures |
| 2664 | // (e.g. Hyperliquid) require a canonical field order. Match the Go |
| 2665 | // port's strategy (go/v4/exchange_eth.go): per-exchange schemas |
| 2666 | // reorder action dicts before packing. Schemas are looked up by |
| 2667 | // the value of the "type" key and applied recursively (nested |
| 2668 | // orders, builder, trigger spec, etc.). |
| 2669 | Object normalized = applyMsgpackSchema(data, null); |
| 2670 | packValue(packer, normalized); |
| 2671 | packer.flush(); |
| 2672 | return out.toByteArray(); |
| 2673 | } catch (java.io.IOException e) { |
| 2674 | throw new RuntimeException("packb failed", e); |
| 2675 | } |
| 2676 | } |
| 2677 | |
| 2678 | // A msgpack schema declares the canonical field order for a Map value |
| 2679 | // and, for fields whose value is itself a Map or a List of Maps, an |
no test coverage detected