From d71cafde7f6916dfc00732378a671e579ee36e90 Mon Sep 17 00:00:00 2001 From: Pablo Date: Mon, 15 Dec 2025 00:48:29 +0100 Subject: [PATCH 01/11] add typescript generator --- .../generation/TargetCodeGeneratorLoader.java | 18 + .../typescript/TypeScriptGenerator.java | 900 ++++++++++++++++++ .../typescript/TypeScriptOutputManager.java | 139 +++ .../generation/typescript/TypeScriptUtil.java | 342 +++++++ 4 files changed, 1399 insertions(+) create mode 100644 sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java create mode 100644 sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptOutputManager.java create mode 100644 sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptUtil.java diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/TargetCodeGeneratorLoader.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/TargetCodeGeneratorLoader.java index db33966a89..1c56a9078e 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/TargetCodeGeneratorLoader.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/TargetCodeGeneratorLoader.java @@ -30,6 +30,8 @@ import uk.co.real_logic.sbe.generation.java.JavaOutputManager; import uk.co.real_logic.sbe.generation.rust.RustGenerator; import uk.co.real_logic.sbe.generation.rust.RustOutputManager; +import uk.co.real_logic.sbe.generation.typescript.TypeScriptGenerator; +import uk.co.real_logic.sbe.generation.typescript.TypeScriptOutputManager; import uk.co.real_logic.sbe.ir.Ir; import static uk.co.real_logic.sbe.SbeTool.*; @@ -173,6 +175,22 @@ public CodeGenerator newInstance(final Ir ir, final String outputDir) System.getProperty(RUST_CRATE_VERSION, RUST_DEFAULT_CRATE_VERSION), new RustOutputManager(outputDir, ir.packageName())); } + }, + + /** + * Generates decoder codecs for the TypeScript programming language. + */ + TYPESCRIPT() + { + /** + * {@inheritDoc} + */ + public CodeGenerator newInstance(final Ir ir, final String outputDir) + { + return new TypeScriptGenerator( + ir, + new TypeScriptOutputManager(outputDir, ir.applicableNamespace())); + } }; /** diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java new file mode 100644 index 0000000000..706a97b66e --- /dev/null +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java @@ -0,0 +1,900 @@ +/* + * Copyright 2013-2025 Real Logic Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package uk.co.real_logic.sbe.generation.typescript; + +import org.agrona.Verify; +import org.agrona.generation.OutputManager; +import uk.co.real_logic.sbe.PrimitiveType; +import uk.co.real_logic.sbe.generation.CodeGenerator; +import uk.co.real_logic.sbe.generation.Generators; +import uk.co.real_logic.sbe.ir.*; + +import java.io.IOException; +import java.io.Writer; +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.List; + +import static uk.co.real_logic.sbe.generation.typescript.TypeScriptUtil.*; +import static uk.co.real_logic.sbe.ir.GenerationUtil.*; + +/** + * Code generator for the TypeScript programming language. + * Generates decoder classes and interfaces for decoding SBE binary messages. + */ +@SuppressWarnings("MethodLength") +public class TypeScriptGenerator implements CodeGenerator +{ + private final Ir ir; + private final TypeScriptOutputManager outputManager; + + /** + * Create a new TypeScript {@link CodeGenerator}. + * + * @param ir for the messages and types. + * @param outputManager for generating the code to. + */ + public TypeScriptGenerator(final Ir ir, final OutputManager outputManager) + { + Verify.notNull(ir, "ir"); + Verify.notNull(outputManager, "outputManager"); + + this.ir = ir; + this.outputManager = (TypeScriptOutputManager)outputManager; + } + + /** + * {@inheritDoc} + */ + @Override + public void generate() throws IOException + { + generateTypeStubs(); + generateMessageHeaderStub(); + + for (final List tokens : ir.messages()) + { + generateMessage(tokens); + } + + outputManager.generateIndexFile(); + } + + /** + * Generate the stubs for the types used as message fields. + * + * @throws IOException if an error is encountered when writing the output. + */ + private void generateTypeStubs() throws IOException + { + for (final List tokens : ir.types()) + { + switch (tokens.get(0).signal()) + { + case BEGIN_ENUM: + generateEnum(tokens); + break; + + case BEGIN_SET: + generateBitSet(tokens); + break; + + case BEGIN_COMPOSITE: + generateComposite(tokens); + break; + + default: + break; + } + } + } + + /** + * Generate the message header stub. + * + * @throws IOException if an error is encountered when writing the output. + */ + private void generateMessageHeaderStub() throws IOException + { + final String typeName = "MessageHeader"; + final List tokens = ir.headerStructure().tokens(); + + try (Writer out = outputManager.createOutput(typeName)) + { + final StringBuilder sb = new StringBuilder(); + sb.append(generateFileHeader(ir.packageName())); + + generateCompositeDecoder(sb, typeName, tokens.subList(1, tokens.size() - 1)); + + out.append(sb); + } + } + + /** + * Generate an enum type. + * + * @param tokens for the enum. + * @throws IOException if an error is encountered when writing the output. + */ + private void generateEnum(final List tokens) throws IOException + { + final Token enumToken = tokens.get(0); + final String enumName = formatTypeName(enumToken.applicableTypeName()); + + try (Writer out = outputManager.createOutput(enumName)) + { + final StringBuilder sb = new StringBuilder(); + sb.append(generateFileHeader(ir.packageName())); + + sb.append(generateDocumentation("", enumToken)); + sb.append("export enum ").append(enumName).append(" {\n"); + + for (int i = 1; i < tokens.size() - 1; i++) + { + final Token token = tokens.get(i); + final String valueName = token.name(); + final String value = token.encoding().constValue().toString(); + + sb.append(generateDocumentation(" ", token)); + sb.append(" ").append(valueName).append(" = ").append(value); + + if (i < tokens.size() - 2) + { + sb.append(",\n"); + } + else + { + sb.append("\n"); + } + } + + sb.append("}\n"); + + out.append(sb); + } + } + + /** + * Generate a bitset type. + * + * @param tokens for the bitset. + * @throws IOException if an error is encountered when writing the output. + */ + private void generateBitSet(final List tokens) throws IOException + { + final Token setToken = tokens.get(0); + final String setName = formatTypeName(setToken.applicableTypeName()); + final String interfaceName = setName; + final String decoderName = setName + "Decoder"; + + try (Writer out = outputManager.createOutput(setName)) + { + final StringBuilder sb = new StringBuilder(); + sb.append(generateFileHeader(ir.packageName())); + + // Generate interface + sb.append(generateDocumentation("", setToken)); + sb.append("export interface ").append(interfaceName).append(" {\n"); + + for (int i = 1; i < tokens.size() - 1; i++) + { + final Token token = tokens.get(i); + sb.append(" ").append(formatFieldName(token.name())).append(": boolean;\n"); + } + + sb.append("}\n\n"); + + // Generate decoder class + sb.append("export class ").append(decoderName).append(" {\n"); + sb.append(" static decode(view: DataView, offset: number, littleEndian: boolean): ") + .append(interfaceName).append(" {\n"); + sb.append(" const bits = view.get") + .append(formatTypeName(setToken.encoding().primitiveType().primitiveName())) + .append("(offset"); + + if (needsEndianness(setToken.encoding().primitiveType())) + { + sb.append(", littleEndian"); + } + + sb.append(");\n\n"); + sb.append(" return {\n"); + + for (int i = 1; i < tokens.size() - 1; i++) + { + final Token token = tokens.get(i); + final int bitPosition = Integer.parseInt(token.encoding().constValue().toString()); + sb.append(" ").append(formatFieldName(token.name())) + .append(": (bits & (1 << ").append(bitPosition).append(")) !== 0"); + + if (i < tokens.size() - 2) + { + sb.append(",\n"); + } + else + { + sb.append("\n"); + } + } + + sb.append(" };\n"); + sb.append(" }\n\n"); + + sb.append(" static getEncodedLength(): number {\n"); + sb.append(" return ").append(setToken.encodedLength()).append(";\n"); + sb.append(" }\n"); + sb.append("}\n"); + + out.append(sb); + } + } + + /** + * Generate a composite type decoder. + * + * @param tokens for the composite. + * @throws IOException if an error is encountered when writing the output. + */ + private void generateComposite(final List tokens) throws IOException + { + final Token compositeToken = tokens.get(0); + final String compositeName = formatTypeName(compositeToken.applicableTypeName()); + + try (Writer out = outputManager.createOutput(compositeName)) + { + final StringBuilder sb = new StringBuilder(); + sb.append(generateFileHeader(ir.packageName())); + + generateCompositeDecoder(sb, compositeName, tokens.subList(1, tokens.size() - 1)); + + out.append(sb); + } + } + + /** + * Generate a composite decoder implementation. + * + * @param sb to append to. + * @param name of the composite. + * @param tokens for the composite fields. + */ + private void generateCompositeDecoder( + final StringBuilder sb, + final String name, + final List tokens) + { + final String interfaceName = name; + final String decoderName = name + "Decoder"; + + // Generate interface + sb.append("export interface ").append(interfaceName).append(" {\n"); + + Generators.forEachField(tokens, (fieldToken, typeToken) -> + { + final String fieldName = formatFieldName(fieldToken.name()); + final String typeName = typeScriptTypeName(typeToken.encoding().primitiveType()); + final boolean isConstant = typeToken.isConstantEncoding(); + + if (isConstant) + { + sb.append(" readonly "); + } + else + { + sb.append(" "); + } + + sb.append(fieldName).append(": ").append(typeName).append(";\n"); + }); + + sb.append("}\n\n"); + + // Generate decoder class + sb.append("export class ").append(decoderName).append(" {\n"); + + // Add constants + Generators.forEachField(tokens, (fieldToken, typeToken) -> + { + if (typeToken.isConstantEncoding()) + { + final String constantName = formatConstantName(fieldToken.name()); + final String value = generateLiteral( + typeToken.encoding().primitiveType(), + typeToken.encoding().constValue().toString()); + + sb.append(" private static readonly ").append(constantName) + .append(" = ").append(value).append(";\n"); + } + }); + + sb.append(" private static readonly ENCODED_LENGTH = ") + .append(tokens.get(0).encodedLength()).append(";\n\n"); + + // Generate decode method + sb.append(" static decode(view: DataView, offset: number, littleEndian: boolean): ") + .append(interfaceName).append(" {\n"); + sb.append(" let pos = offset;\n\n"); + + final List fieldNames = new ArrayList<>(); + final List fieldValues = new ArrayList<>(); + + Generators.forEachField(tokens, (fieldToken, typeToken) -> + { + final String fieldName = formatFieldName(fieldToken.name()); + fieldNames.add(fieldName); + + if (typeToken.isConstantEncoding()) + { + // Constant field - not read from buffer + final String constantName = formatConstantName(fieldToken.name()); + fieldValues.add(decoderName + "." + constantName); + } + else + { + // Regular field - read from buffer + final PrimitiveType primitiveType = typeToken.encoding().primitiveType(); + final String dataViewMethod = dataViewMethod(primitiveType); + + sb.append(" const ").append(fieldName).append(" = view.") + .append(dataViewMethod).append("(pos"); + + if (needsEndianness(primitiveType)) + { + sb.append(", littleEndian"); + } + + sb.append(");\n"); + sb.append(" pos += ").append(typeToken.encodedLength()).append(";\n\n"); + + fieldValues.add(fieldName); + } + }); + + sb.append(" return {\n"); + for (int i = 0; i < fieldNames.size(); i++) + { + sb.append(" ").append(fieldNames.get(i)).append(": ").append(fieldValues.get(i)); + if (i < fieldNames.size() - 1) + { + sb.append(",\n"); + } + else + { + sb.append("\n"); + } + } + sb.append(" };\n"); + sb.append(" }\n\n"); + + sb.append(" static getEncodedLength(): number {\n"); + sb.append(" return ").append(decoderName).append(".ENCODED_LENGTH;\n"); + sb.append(" }\n"); + sb.append("}\n"); + } + + /** + * Generate a message decoder. + * + * @param tokens for the message. + * @throws IOException if an error is encountered when writing the output. + */ + private void generateMessage(final List tokens) throws IOException + { + final Token msgToken = tokens.get(0); + final String messageName = formatTypeName(msgToken.name()); + + try (Writer out = outputManager.createOutput(messageName)) + { + final StringBuilder sb = new StringBuilder(); + sb.append(generateFileHeader(ir.packageName())); + + final List messageBody = tokens.subList(1, tokens.size() - 1); + int i = 0; + + final List fields = new ArrayList<>(); + i = collectFields(messageBody, i, fields); + + final List groups = new ArrayList<>(); + i = collectGroups(messageBody, i, groups); + + final List varData = new ArrayList<>(); + collectVarData(messageBody, i, varData); + + generateMessageDecoder(sb, messageName, msgToken, fields, groups, varData); + + out.append(sb); + } + } + + /** + * Generate a message decoder implementation. + * + * @param sb to append to. + * @param messageName the name of the message. + * @param msgToken the message token. + * @param fields the field tokens. + * @param groups the group tokens. + * @param varData the variable-length data tokens. + */ + private void generateMessageDecoder( + final StringBuilder sb, + final String messageName, + final Token msgToken, + final List fields, + final List groups, + final List varData) + { + final String interfaceName = messageName; + final String decoderName = messageName + "Decoder"; + + // Generate interface first + generateMessageInterface(sb, interfaceName, fields, groups, varData); + sb.append("\n"); + + // Generate decoder class + sb.append("export class ").append(decoderName).append(" {\n"); + + // Add constants + sb.append(" private static readonly BLOCK_LENGTH = ").append(msgToken.encodedLength()).append(";\n"); + sb.append(" private static readonly TEMPLATE_ID = ").append(msgToken.id()).append(";\n"); + sb.append(" private static readonly SCHEMA_ID = ").append(ir.id()).append(";\n"); + sb.append(" private static readonly SCHEMA_VERSION = ").append(ir.version()).append(";\n\n"); + + sb.append(" private readonly littleEndian: boolean;\n\n"); + + // Constructor + final String defaultEndian = ir.byteOrder() == ByteOrder.LITTLE_ENDIAN ? "little" : "big"; + sb.append(" constructor(byteOrder: 'little' | 'big' = '").append(defaultEndian).append("') {\n"); + sb.append(" this.littleEndian = byteOrder === 'little';\n"); + sb.append(" }\n\n"); + + // Generate decode method + generateDecodeMethod(sb, interfaceName, decoderName, fields, groups, varData); + + // Generate group decoder methods + generateGroupDecoderMethods(sb, groups, messageName); + + // Generate variable data decoder methods + generateVarDataDecoderMethods(sb, varData); + + // Generate static methods + sb.append("\n static getBlockLength(): number {\n"); + sb.append(" return ").append(decoderName).append(".BLOCK_LENGTH;\n"); + sb.append(" }\n\n"); + + sb.append(" static getTemplateId(): number {\n"); + sb.append(" return ").append(decoderName).append(".TEMPLATE_ID;\n"); + sb.append(" }\n\n"); + + sb.append(" static getSchemaId(): number {\n"); + sb.append(" return ").append(decoderName).append(".SCHEMA_ID;\n"); + sb.append(" }\n\n"); + + sb.append(" static getSchemaVersion(): number {\n"); + sb.append(" return ").append(decoderName).append(".SCHEMA_VERSION;\n"); + sb.append(" }\n"); + + sb.append("}\n"); + } + + /** + * Generate a message interface. + * + * @param sb to append to. + * @param interfaceName the interface name. + * @param fields the field tokens. + * @param groups the group tokens. + * @param varData the variable-length data tokens. + */ + private void generateMessageInterface( + final StringBuilder sb, + final String interfaceName, + final List fields, + final List groups, + final List varData) + { + sb.append("export interface ").append(interfaceName).append(" {\n"); + + // Fields + Generators.forEachField(fields, (fieldToken, typeToken) -> + { + final String fieldName = formatFieldName(fieldToken.name()); + final String typeName = typeScriptTypeName(typeToken.encoding().primitiveType()); + sb.append(" ").append(fieldName).append(": ").append(typeName).append(";\n"); + }); + + // Groups + for (int i = 0; i < groups.size();) + { + final Token groupToken = groups.get(i); + if (groupToken.signal() == Signal.BEGIN_GROUP) + { + final String groupName = formatTypeName(groupToken.name()); + final String fieldName = formatFieldName(groupToken.name()); + sb.append(" ").append(fieldName).append(": ").append(groupName).append("[];\n"); + + i += groupToken.componentTokenCount(); + } + else + { + i++; + } + } + + // Variable-length data + for (int i = 0; i < varData.size();) + { + final Token varDataToken = varData.get(i); + if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) + { + final String fieldName = formatFieldName(varDataToken.name()); + final Encoding encoding = varDataToken.encoding(); + final String characterEncoding = encoding.characterEncoding(); + + if (null == characterEncoding) + { + sb.append(" ").append(fieldName).append(": Uint8Array;\n"); + } + else + { + sb.append(" ").append(fieldName).append(": string;\n"); + } + + i += varDataToken.componentTokenCount(); + } + else + { + i++; + } + } + + sb.append("}\n"); + } + + /** + * Generate the main decode method. + * + * @param sb to append to. + * @param interfaceName the interface name. + * @param decoderName the decoder class name. + * @param fields the field tokens. + * @param groups the group tokens. + * @param varData the variable-length data tokens. + */ + private void generateDecodeMethod( + final StringBuilder sb, + final String interfaceName, + final String decoderName, + final List fields, + final List groups, + final List varData) + { + sb.append(" decode(buffer: ArrayBuffer, offset: number = 0): ").append(interfaceName).append(" {\n"); + sb.append(" const view = new DataView(buffer);\n"); + sb.append(" let pos = offset;\n\n"); + + // Decode fields + final List fieldNames = new ArrayList<>(); + final List fieldValues = new ArrayList<>(); + + Generators.forEachField(fields, (fieldToken, typeToken) -> + { + final String fieldName = formatFieldName(fieldToken.name()); + fieldNames.add(fieldName); + + final PrimitiveType primitiveType = typeToken.encoding().primitiveType(); + final String dataViewMethod = dataViewMethod(primitiveType); + + sb.append(" const ").append(fieldName).append(" = view.") + .append(dataViewMethod).append("(pos"); + + if (needsEndianness(primitiveType)) + { + sb.append(", this.littleEndian"); + } + + sb.append(");\n"); + sb.append(" pos += ").append(typeToken.encodedLength()).append(";\n\n"); + + fieldValues.add(fieldName); + }); + + // Skip to block end for forward compatibility + sb.append(" // Skip to end of block for forward compatibility\n"); + sb.append(" pos = offset + ").append(decoderName).append(".BLOCK_LENGTH;\n\n"); + + // Decode groups + for (int i = 0; i < groups.size();) + { + final Token groupToken = groups.get(i); + if (groupToken.signal() == Signal.BEGIN_GROUP) + { + final String groupName = formatTypeName(groupToken.name()); + final String fieldName = formatFieldName(groupToken.name()); + final String methodName = "decode" + groupName + "Group"; + + sb.append(" const ").append(fieldName).append(" = this.") + .append(methodName).append("(view, pos);\n"); + sb.append(" pos = ").append(fieldName).append(".nextOffset;\n\n"); + + fieldNames.add(fieldName); + fieldValues.add(fieldName + ".items"); + + i += groupToken.componentTokenCount(); + } + else + { + i++; + } + } + + // Decode variable-length data + for (int i = 0; i < varData.size();) + { + final Token varDataToken = varData.get(i); + if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) + { + final String fieldName = formatFieldName(varDataToken.name()); + final Encoding encoding = varDataToken.encoding(); + final String characterEncoding = encoding.characterEncoding(); + + if (null == characterEncoding) + { + sb.append(" const ").append(fieldName).append(" = this.decodeVarData(view, pos);\n"); + } + else if ("UTF-8".equals(characterEncoding)) + { + sb.append(" const ").append(fieldName).append(" = this.decodeVarStringUtf8(view, pos);\n"); + } + else + { + sb.append(" const ").append(fieldName).append(" = this.decodeVarStringAscii(view, pos);\n"); + } + + sb.append(" pos = ").append(fieldName).append(".nextOffset;\n\n"); + + fieldNames.add(fieldName); + fieldValues.add(fieldName + ".value"); + + i += varDataToken.componentTokenCount(); + } + else + { + i++; + } + } + + // Return object + sb.append(" return {\n"); + for (int i = 0; i < fieldNames.size(); i++) + { + sb.append(" ").append(fieldNames.get(i)).append(": ").append(fieldValues.get(i)); + if (i < fieldNames.size() - 1) + { + sb.append(",\n"); + } + else + { + sb.append("\n"); + } + } + sb.append(" };\n"); + sb.append(" }\n"); + } + + /** + * Generate group decoder methods. + * + * @param sb to append to. + * @param groups the group tokens. + * @param parentName the parent message name. + */ + private void generateGroupDecoderMethods( + final StringBuilder sb, + final List groups, + final String parentName) + { + for (int i = 0; i < groups.size();) + { + final Token groupToken = groups.get(i); + if (groupToken.signal() == Signal.BEGIN_GROUP) + { + final String groupName = formatTypeName(groupToken.name()); + final List groupTokens = new ArrayList<>(); + + final int endIndex = i + groupToken.componentTokenCount(); + for (int j = i; j < endIndex; j++) + { + groupTokens.add(groups.get(j)); + } + + // First, generate the interface for the group + final List groupBody = groupTokens.subList(1, groupTokens.size() - 1); + + // Generate group interface + sb.append("\nexport interface ").append(groupName).append(" {\n"); + + Generators.forEachField(groupBody, (fieldToken, typeToken) -> + { + final String fieldName = formatFieldName(fieldToken.name()); + final String typeName = typeScriptTypeName(typeToken.encoding().primitiveType()); + sb.append(" ").append(fieldName).append(": ").append(typeName).append(";\n"); + }); + + sb.append("}\n\n"); + + // Generate group decoder method + final String methodName = "decode" + groupName + "Group"; + sb.append(" private ").append(methodName) + .append("(view: DataView, offset: number): { items: ") + .append(groupName).append("[], nextOffset: number } {\n"); + + sb.append(" let pos = offset;\n\n"); + + // Read group header + sb.append(" const blockLength = view.getUint16(pos, this.littleEndian);\n"); + sb.append(" pos += 2;\n"); + sb.append(" const numInGroup = view.getUint16(pos, this.littleEndian);\n"); + sb.append(" pos += 2;\n\n"); + + sb.append(" const items: ").append(groupName).append("[] = [];\n\n"); + + sb.append(" for (let i = 0; i < numInGroup; i++) {\n"); + sb.append(" const itemStart = pos;\n\n"); + + // Decode group fields + final List groupFieldNames = new ArrayList<>(); + final List groupFieldValues = new ArrayList<>(); + + Generators.forEachField(groupBody, (fieldToken, typeToken) -> + { + final String fieldName = formatFieldName(fieldToken.name()); + groupFieldNames.add(fieldName); + + final PrimitiveType primitiveType = typeToken.encoding().primitiveType(); + final String dataViewMethod = dataViewMethod(primitiveType); + + sb.append(" const ").append(fieldName).append(" = view.") + .append(dataViewMethod).append("(pos"); + + if (needsEndianness(primitiveType)) + { + sb.append(", this.littleEndian"); + } + + sb.append(");\n"); + sb.append(" pos += ").append(typeToken.encodedLength()).append(";\n\n"); + + groupFieldValues.add(fieldName); + }); + + // Skip to next block for forward compatibility + sb.append(" // Skip to next block for forward compatibility\n"); + sb.append(" pos = itemStart + blockLength;\n\n"); + + // Add item to array + sb.append(" items.push({\n"); + for (int k = 0; k < groupFieldNames.size(); k++) + { + sb.append(" ").append(groupFieldNames.get(k)).append(": ").append(groupFieldValues.get(k)); + if (k < groupFieldNames.size() - 1) + { + sb.append(",\n"); + } + else + { + sb.append("\n"); + } + } + sb.append(" });\n"); + + sb.append(" }\n\n"); + + sb.append(" return { items, nextOffset: pos };\n"); + sb.append(" }\n"); + + i = endIndex; + } + else + { + i++; + } + } + } + + /** + * Generate variable-length data decoder methods. + * + * @param sb to append to. + * @param varData the variable-length data tokens. + */ + private void generateVarDataDecoderMethods(final StringBuilder sb, final List varData) + { + boolean needsVarDataDecoder = false; + boolean needsUtf8Decoder = false; + boolean needsAsciiDecoder = false; + + for (int i = 0; i < varData.size();) + { + final Token varDataToken = varData.get(i); + if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) + { + final Encoding encoding = varDataToken.encoding(); + final String characterEncoding = encoding.characterEncoding(); + + if (null == characterEncoding) + { + needsVarDataDecoder = true; + } + else if ("UTF-8".equals(characterEncoding)) + { + needsUtf8Decoder = true; + } + else + { + needsAsciiDecoder = true; + } + + i += varDataToken.componentTokenCount(); + } + else + { + i++; + } + } + + if (needsVarDataDecoder) + { + sb.append("\n private decodeVarData(view: DataView, offset: number): ") + .append("{ value: Uint8Array, nextOffset: number } {\n"); + sb.append(" let pos = offset;\n\n"); + sb.append(" const length = view.getUint32(pos, this.littleEndian);\n"); + sb.append(" pos += 4;\n\n"); + sb.append(" const value = new Uint8Array(view.buffer, view.byteOffset + pos, length);\n"); + sb.append(" pos += length;\n\n"); + sb.append(" return { value, nextOffset: pos };\n"); + sb.append(" }\n"); + } + + if (needsUtf8Decoder) + { + sb.append("\n private decodeVarStringUtf8(view: DataView, offset: number): ") + .append("{ value: string, nextOffset: number } {\n"); + sb.append(" let pos = offset;\n\n"); + sb.append(" const length = view.getUint32(pos, this.littleEndian);\n"); + sb.append(" pos += 4;\n\n"); + sb.append(" const bytes = new Uint8Array(view.buffer, view.byteOffset + pos, length);\n"); + sb.append(" const value = new TextDecoder('utf-8').decode(bytes);\n"); + sb.append(" pos += length;\n\n"); + sb.append(" return { value, nextOffset: pos };\n"); + sb.append(" }\n"); + } + + if (needsAsciiDecoder) + { + sb.append("\n private decodeVarStringAscii(view: DataView, offset: number): ") + .append("{ value: string, nextOffset: number } {\n"); + sb.append(" let pos = offset;\n\n"); + sb.append(" const length = view.getUint32(pos, this.littleEndian);\n"); + sb.append(" pos += 4;\n\n"); + sb.append(" const bytes = new Uint8Array(view.buffer, view.byteOffset + pos, length);\n"); + sb.append(" const value = new TextDecoder('ascii').decode(bytes);\n"); + sb.append(" pos += length;\n\n"); + sb.append(" return { value, nextOffset: pos };\n"); + sb.append(" }\n"); + } + } +} diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptOutputManager.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptOutputManager.java new file mode 100644 index 0000000000..fad8e3f02d --- /dev/null +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptOutputManager.java @@ -0,0 +1,139 @@ +/* + * Copyright 2013-2025 Real Logic Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package uk.co.real_logic.sbe.generation.typescript; + +import org.agrona.Verify; +import org.agrona.generation.OutputManager; + +import java.io.File; +import java.io.IOException; +import java.io.Writer; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; + +import static java.io.File.separatorChar; +import static java.nio.charset.StandardCharsets.UTF_8; + +/** + * {@link OutputManager} for managing the creation of TypeScript source files as the target of code generation. + * The character encoding for the {@link Writer} is UTF-8. + */ +public class TypeScriptOutputManager implements OutputManager +{ + private final File outputDir; + private final List generatedFiles = new ArrayList<>(); + + /** + * Create a new {@link OutputManager} for generating TypeScript source files into a given namespace directory. + * + * @param baseDirName for the generated source code. + * @param packageName for the generated source code relative to the baseDirName. + */ + public TypeScriptOutputManager(final String baseDirName, final String packageName) + { + Verify.notNull(baseDirName, "baseDirName"); + Verify.notNull(packageName, "packageName"); + + String dirName = baseDirName.endsWith("" + separatorChar) ? baseDirName : baseDirName + separatorChar; + + // Convert package name to directory path (e.g., "com.example" -> "com/example") + if (packageName != null && !packageName.isEmpty()) + { + dirName += packageName.replace('.', separatorChar); + } + + this.outputDir = createDir(dirName); + } + + private static File createDir(final String dirName) + { + final File dir = new File(dirName); + if (!dir.exists() && !dir.mkdirs()) + { + throw new IllegalStateException("Unable to create directory: " + dirName); + } + + return dir; + } + + /** + * Create a new output which will be a TypeScript source file in the given namespace directory. + *

+ * The {@link Writer} should be closed once the caller has finished with it. The Writer is + * buffered for efficient IO operations. + * + * @param name the name of the TypeScript type/class (without .ts extension). + * @return a {@link Writer} to which the source code should be written. + * @throws IOException if an issue occurs when creating the file. + */ + @Override + public Writer createOutput(final String name) throws IOException + { + final String fileName = name + ".ts"; + final File targetFile = new File(outputDir, fileName); + generatedFiles.add(name); + return Files.newBufferedWriter(targetFile.toPath(), UTF_8); + } + + /** + * Generate an index.ts barrel file that exports all generated TypeScript modules. + * This provides a convenient single entry point for importing all generated types. + * + * @throws IOException if an issue occurs when creating the file. + */ + public void generateIndexFile() throws IOException + { + if (generatedFiles.isEmpty()) + { + return; + } + + final File indexFile = new File(outputDir, "index.ts"); + try (Writer writer = Files.newBufferedWriter(indexFile.toPath(), UTF_8)) + { + writer.write("/**\n"); + writer.write(" * Barrel export file for all generated SBE types\n"); + writer.write(" * Auto-generated - DO NOT EDIT\n"); + writer.write(" */\n\n"); + + for (final String fileName : generatedFiles) + { + writer.write("export * from './" + fileName + "';\n"); + } + } + } + + /** + * Get the output directory path. + * + * @return the output directory. + */ + public File getOutputDir() + { + return outputDir; + } + + /** + * Get the list of generated file names (without .ts extension). + * + * @return list of generated file names. + */ + public List getGeneratedFiles() + { + return new ArrayList<>(generatedFiles); + } +} diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptUtil.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptUtil.java new file mode 100644 index 0000000000..a6dd8a9b10 --- /dev/null +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptUtil.java @@ -0,0 +1,342 @@ +/* + * Copyright 2013-2025 Real Logic Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package uk.co.real_logic.sbe.generation.typescript; + +import uk.co.real_logic.sbe.PrimitiveType; +import uk.co.real_logic.sbe.generation.Generators; +import uk.co.real_logic.sbe.ir.Token; + +import java.util.EnumMap; +import java.util.Map; + +/** + * Utilities for mapping between IR and the TypeScript language. + */ +public class TypeScriptUtil +{ + private static final Map PRIMITIVE_TYPE_MAP = new EnumMap<>(PrimitiveType.class); + private static final Map DATAVIEW_METHOD_MAP = new EnumMap<>(PrimitiveType.class); + + static + { + // TypeScript type mappings + PRIMITIVE_TYPE_MAP.put(PrimitiveType.CHAR, "number"); + PRIMITIVE_TYPE_MAP.put(PrimitiveType.INT8, "number"); + PRIMITIVE_TYPE_MAP.put(PrimitiveType.INT16, "number"); + PRIMITIVE_TYPE_MAP.put(PrimitiveType.INT32, "number"); + PRIMITIVE_TYPE_MAP.put(PrimitiveType.INT64, "bigint"); + PRIMITIVE_TYPE_MAP.put(PrimitiveType.UINT8, "number"); + PRIMITIVE_TYPE_MAP.put(PrimitiveType.UINT16, "number"); + PRIMITIVE_TYPE_MAP.put(PrimitiveType.UINT32, "number"); + PRIMITIVE_TYPE_MAP.put(PrimitiveType.UINT64, "bigint"); + PRIMITIVE_TYPE_MAP.put(PrimitiveType.FLOAT, "number"); + PRIMITIVE_TYPE_MAP.put(PrimitiveType.DOUBLE, "number"); + + // DataView method mappings + DATAVIEW_METHOD_MAP.put(PrimitiveType.CHAR, "getUint8"); + DATAVIEW_METHOD_MAP.put(PrimitiveType.INT8, "getInt8"); + DATAVIEW_METHOD_MAP.put(PrimitiveType.INT16, "getInt16"); + DATAVIEW_METHOD_MAP.put(PrimitiveType.INT32, "getInt32"); + DATAVIEW_METHOD_MAP.put(PrimitiveType.INT64, "getBigInt64"); + DATAVIEW_METHOD_MAP.put(PrimitiveType.UINT8, "getUint8"); + DATAVIEW_METHOD_MAP.put(PrimitiveType.UINT16, "getUint16"); + DATAVIEW_METHOD_MAP.put(PrimitiveType.UINT32, "getUint32"); + DATAVIEW_METHOD_MAP.put(PrimitiveType.UINT64, "getBigUint64"); + DATAVIEW_METHOD_MAP.put(PrimitiveType.FLOAT, "getFloat32"); + DATAVIEW_METHOD_MAP.put(PrimitiveType.DOUBLE, "getFloat64"); + } + + /** + * Map an SBE {@link PrimitiveType} to a TypeScript primitive type name. + * + * @param primitiveType to map. + * @return the TypeScript type name. + */ + public static String typeScriptTypeName(final PrimitiveType primitiveType) + { + return PRIMITIVE_TYPE_MAP.get(primitiveType); + } + + /** + * Map an SBE {@link PrimitiveType} to a DataView method name for reading. + * + * @param primitiveType to map. + * @return the DataView method name. + */ + public static String dataViewMethod(final PrimitiveType primitiveType) + { + return DATAVIEW_METHOD_MAP.get(primitiveType); + } + + /** + * Check if a DataView method requires the littleEndian parameter. + * + * @param primitiveType to check. + * @return true if the method requires the littleEndian parameter. + */ + public static boolean needsEndianness(final PrimitiveType primitiveType) + { + // INT8, UINT8 don't need endianness parameter + return primitiveType != PrimitiveType.INT8 && primitiveType != PrimitiveType.UINT8 && + primitiveType != PrimitiveType.CHAR; + } + + /** + * Generate a TypeScript literal value for a given primitive type and value. + * + * @param type the primitive type. + * @param value the value as a string. + * @return the TypeScript literal. + */ + public static String generateLiteral(final PrimitiveType type, final String value) + { + switch (type) + { + case CHAR: + case INT8: + case UINT8: + case INT16: + case UINT16: + case INT32: + case UINT32: + return value; + + case INT64: + case UINT64: + // BigInt literals need 'n' suffix + return value + "n"; + + case FLOAT: + if (value.endsWith("NaN")) + { + return "NaN"; + } + return value; + + case DOUBLE: + if (value.endsWith("NaN")) + { + return "NaN"; + } + return value; + + default: + return value; + } + } + + /** + * Generate a TypeScript null value literal for a given primitive type. + * + * @param type the primitive type. + * @return the TypeScript null value literal. + */ + public static String generateNullValueLiteral(final PrimitiveType type) + { + switch (type) + { + case CHAR: + case UINT8: + return "255"; + + case INT8: + return "-128"; + + case INT16: + return "-32768"; + + case UINT16: + return "65535"; + + case INT32: + return "-2147483648"; + + case UINT32: + return "4294967295"; + + case INT64: + return "-9223372036854775808n"; + + case UINT64: + return "18446744073709551615n"; + + case FLOAT: + return "NaN"; + + case DOUBLE: + return "NaN"; + + default: + return "null"; + } + } + + /** + * Format a class/type name in PascalCase. + * + * @param value the string to format. + * @return the formatted string. + */ + public static String formatTypeName(final String value) + { + return Generators.toUpperFirstChar(value); + } + + /** + * Format a field/property name in camelCase. + * + * @param value the string to format. + * @return the formatted string. + */ + public static String formatFieldName(final String value) + { + return Generators.toLowerFirstChar(value); + } + + /** + * Format a constant name in UPPER_SNAKE_CASE. + * + * @param value the string to format. + * @return the formatted string. + */ + public static String formatConstantName(final String value) + { + return value.toUpperCase().replaceAll("([a-z])([A-Z])", "$1_$2").replace(' ', '_'); + } + + /** + * Generate file header with auto-generated comment. + * + * @param packageName the package/namespace name. + * @return the file header string. + */ + public static String generateFileHeader(final String packageName) + { + return "/**\n" + + " * Auto-generated by SBE (Simple Binary Encoding)\n" + + " * Schema: " + packageName + "\n" + + " * DO NOT EDIT\n" + + " */\n\n"; + } + + /** + * Generate JSDoc documentation from token description. + * + * @param indent the indentation string. + * @param token the token containing description. + * @return the JSDoc string or empty if no description. + */ + public static String generateDocumentation(final String indent, final Token token) + { + final String description = token.description(); + if (null == description || description.isEmpty()) + { + return ""; + } + + return indent + "/**\n" + + indent + " * " + description + "\n" + + indent + " */\n"; + } + + /** + * Check if a name is a TypeScript reserved keyword. + * + * @param name the name to check. + * @return true if the name is a reserved keyword. + */ + public static boolean isReservedKeyword(final String name) + { + switch (name) + { + case "break": + case "case": + case "catch": + case "class": + case "const": + case "continue": + case "debugger": + case "default": + case "delete": + case "do": + case "else": + case "enum": + case "export": + case "extends": + case "false": + case "finally": + case "for": + case "function": + case "if": + case "import": + case "in": + case "instanceof": + case "new": + case "null": + case "return": + case "super": + case "switch": + case "this": + case "throw": + case "true": + case "try": + case "typeof": + case "var": + case "void": + case "while": + case "with": + case "as": + case "implements": + case "interface": + case "let": + case "package": + case "private": + case "protected": + case "public": + case "static": + case "yield": + case "any": + case "boolean": + case "constructor": + case "declare": + case "get": + case "module": + case "require": + case "number": + case "set": + case "string": + case "symbol": + case "type": + case "from": + case "of": + return true; + + default: + return false; + } + } + + /** + * Escape a name if it's a TypeScript reserved keyword. + * + * @param name the name to escape. + * @return the escaped name with underscore prefix if needed. + */ + public static String escapeName(final String name) + { + return isReservedKeyword(name) ? "_" + name : name; + } +} From 197cc4fc9cd1ed6bfaa0455b5601fd6de628c355 Mon Sep 17 00:00:00 2001 From: Pablo Date: Mon, 15 Dec 2025 01:40:22 +0100 Subject: [PATCH 02/11] add python generator --- .../uk/co/real_logic/sbe/ValidationUtil.java | 81 +++ .../generation/TargetCodeGeneratorLoader.java | 18 + .../generation/python/PythonGenerator.java | 460 ++++++++++++++++++ .../python/PythonOutputManager.java | 72 +++ .../sbe/generation/python/PythonUtil.java | 159 ++++++ 5 files changed, 790 insertions(+) create mode 100644 sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonGenerator.java create mode 100644 sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonOutputManager.java create mode 100644 sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonUtil.java diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/ValidationUtil.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/ValidationUtil.java index 7ba93c7bd0..08ec1e5ceb 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/ValidationUtil.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/ValidationUtil.java @@ -517,4 +517,85 @@ private static boolean isSbeCSharpIdentifierPart(final char c) return false; } } + + /* https://docs.python.org/3/reference/lexical_analysis.html#keywords */ + private static final Set PYTHON_KEYWORDS = Set.of( + "False", "None", "True", "and", "as", "assert", "async", "await", + "break", "class", "continue", "def", "del", "elif", "else", "except", + "finally", "for", "from", "global", "if", "import", "in", "is", + "lambda", "nonlocal", "not", "or", "pass", "raise", "return", + "try", "while", "with", "yield"); + + /** + * Check value for validity of usage as a Python identifier. + * Python identifiers + * + * @param value to check + * @return true for validity as a Python name. false if not. + */ + public static boolean isSbePythonName(final String value) + { + if (possiblePythonKeyword(value)) + { + if (isPythonKeyword(value)) + { + return false; + } + } + else + { + return false; + } + + return true; + } + + /** + * Is the token a Python language keyword? + * + * @param token to be checked. + * @return true if the token a Python language keyword. + */ + public static boolean isPythonKeyword(final String token) + { + return PYTHON_KEYWORDS.contains(token); + } + + /** + * Is the value a possible Python language keyword? + * + * @param value to be checked. + * @return true if the value is a possible Python language keyword. + */ + private static boolean possiblePythonKeyword(final String value) + { + for (int i = 0, size = value.length(); i < size; i++) + { + final char c = value.charAt(i); + + if (i == 0 && isSbePythonIdentifierStart(c)) + { + continue; + } + + if (isSbePythonIdentifierPart(c)) + { + continue; + } + + return false; + } + + return true; + } + + private static boolean isSbePythonIdentifierStart(final char c) + { + return Character.isLetter(c) || c == '_'; + } + + private static boolean isSbePythonIdentifierPart(final char c) + { + return Character.isLetterOrDigit(c) || c == '_'; + } } diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/TargetCodeGeneratorLoader.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/TargetCodeGeneratorLoader.java index 1c56a9078e..831d982968 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/TargetCodeGeneratorLoader.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/TargetCodeGeneratorLoader.java @@ -32,6 +32,8 @@ import uk.co.real_logic.sbe.generation.rust.RustOutputManager; import uk.co.real_logic.sbe.generation.typescript.TypeScriptGenerator; import uk.co.real_logic.sbe.generation.typescript.TypeScriptOutputManager; +import uk.co.real_logic.sbe.generation.python.PythonGenerator; +import uk.co.real_logic.sbe.generation.python.PythonOutputManager; import uk.co.real_logic.sbe.ir.Ir; import static uk.co.real_logic.sbe.SbeTool.*; @@ -191,6 +193,22 @@ public CodeGenerator newInstance(final Ir ir, final String outputDir) ir, new TypeScriptOutputManager(outputDir, ir.applicableNamespace())); } + }, + + /** + * Generates decoder codecs for the Python programming language. + */ + PYTHON() + { + /** + * {@inheritDoc} + */ + public CodeGenerator newInstance(final Ir ir, final String outputDir) + { + return new PythonGenerator( + ir, + new PythonOutputManager(outputDir, ir.applicableNamespace())); + } }; /** diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonGenerator.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonGenerator.java new file mode 100644 index 0000000000..43c49e7d52 --- /dev/null +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonGenerator.java @@ -0,0 +1,460 @@ +/* + * Copyright 2013-2025 Real Logic Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package uk.co.real_logic.sbe.generation.python; + +import uk.co.real_logic.sbe.generation.CodeGenerator; +import org.agrona.generation.OutputManager; +import uk.co.real_logic.sbe.ir.*; +import org.agrona.Verify; + +import java.io.IOException; +import java.io.Writer; +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.List; + +import static uk.co.real_logic.sbe.generation.python.PythonUtil.*; +import static uk.co.real_logic.sbe.ir.GenerationUtil.collectVarData; +import static uk.co.real_logic.sbe.ir.GenerationUtil.collectGroups; +import static uk.co.real_logic.sbe.ir.GenerationUtil.collectFields; + +/** + * Codec generator for the Python programming language. + */ +@SuppressWarnings("MethodLength") +public class PythonGenerator implements CodeGenerator +{ + private final Ir ir; + private final OutputManager outputManager; + + /** + * Create a new Python language {@link CodeGenerator}. + * + * @param ir for the messages and types. + * @param outputManager for generating the codecs to. + */ + public PythonGenerator(final Ir ir, final OutputManager outputManager) + { + Verify.notNull(ir, "ir"); + Verify.notNull(outputManager, "outputManager"); + + this.ir = ir; + this.outputManager = outputManager; + } + + /** + * {@inheritDoc} + */ + public void generate() throws IOException + { + generatePackageInit(); + generateTypeStubs(); + + for (final List tokens : ir.messages()) + { + final Token msgToken = tokens.get(0); + final String className = formatClassName(msgToken.name()); + + try (Writer out = outputManager.createOutput(className)) + { + final StringBuilder sb = new StringBuilder(); + + generateFileHeader(sb); + generateMessageClass(sb, className, tokens); + + out.append(sb); + } + } + } + + private void generatePackageInit() throws IOException + { + try (Writer out = outputManager.createOutput("__init__")) + { + out.append("\"\"\"Generated SBE (Simple Binary Encoding) message codecs.\"\"\"\n"); + } + } + + private void generateFileHeader(final StringBuilder sb) + { + sb.append("\"\"\"Generated SBE (Simple Binary Encoding) message codec.\"\"\"\n\n"); + sb.append("import struct\n"); + sb.append("from typing import List, Optional, Tuple\n"); + sb.append("from io import BytesIO\n\n"); + } + + private void generateTypeStubs() throws IOException + { + for (final List tokens : ir.types()) + { + switch (tokens.get(0).signal()) + { + case BEGIN_ENUM: + generateEnum(tokens); + break; + + case BEGIN_SET: + generateChoiceSet(tokens); + break; + + case BEGIN_COMPOSITE: + generateComposite(tokens); + break; + + default: + break; + } + } + } + + private void generateEnum(final List tokens) throws IOException + { + final Token enumToken = tokens.get(0); + final String enumName = formatClassName(enumToken.applicableTypeName()); + + try (Writer out = outputManager.createOutput(enumName)) + { + final StringBuilder sb = new StringBuilder(); + + generateFileHeader(sb); + + sb.append(String.format("class %s:\n", enumName)); + sb.append(" \"\"\"Enum values.\"\"\"\n"); + + for (int i = 1; i < tokens.size() - 1; i++) + { + final Token token = tokens.get(i); + final String name = formatPropertyName(token.name()).toUpperCase(); + final String value = token.encoding().constValue().toString(); + sb.append(String.format(" %s = %s\n", name, value)); + } + + // Add null value + final String nullValue = enumToken.encoding().applicableNullValue().toString(); + sb.append(String.format(" NULL_VALUE = %s\n\n", nullValue)); + + // Add size method + sb.append(String.format(" @staticmethod\n")); + sb.append(String.format(" def encoded_length() -> int:\n")); + sb.append(String.format(" return %d\n", enumToken.encodedLength())); + + out.append(sb); + } + } + + private void generateChoiceSet(final List tokens) throws IOException + { + final Token choiceToken = tokens.get(0); + final String choiceName = formatClassName(choiceToken.applicableTypeName()); + + try (Writer out = outputManager.createOutput(choiceName)) + { + final StringBuilder sb = new StringBuilder(); + + generateFileHeader(sb); + + sb.append(String.format("class %s:\n", choiceName)); + sb.append(" \"\"\"Choice set values.\"\"\"\n"); + + for (int i = 1; i < tokens.size() - 1; i++) + { + final Token token = tokens.get(i); + final String name = formatPropertyName(token.name()).toUpperCase(); + final String value = token.encoding().constValue().toString(); + sb.append(String.format(" %s = %s\n", name, value)); + } + + sb.append("\n"); + sb.append(String.format(" @staticmethod\n")); + sb.append(String.format(" def encoded_length() -> int:\n")); + sb.append(String.format(" return %d\n", choiceToken.encodedLength())); + + out.append(sb); + } + } + + private void generateComposite(final List tokens) throws IOException + { + final Token compositeToken = tokens.get(0); + final String compositeName = formatClassName(compositeToken.applicableTypeName()); + + try (Writer out = outputManager.createOutput(compositeName)) + { + final StringBuilder sb = new StringBuilder(); + + generateFileHeader(sb); + + sb.append(String.format("class %s:\n", compositeName)); + sb.append(" \"\"\"Composite type.\"\"\"\n\n"); + sb.append(" def __init__(self):\n"); + + // Initialize fields + for (int i = 1; i < tokens.size() - 1; i++) + { + final Token token = tokens.get(i); + if (token.signal() == Signal.ENCODING) + { + final String propertyName = formatPropertyName(token.name()); + if (token.arrayLength() > 1) + { + sb.append(String.format(" self.%s = [0] * %d\n", propertyName, token.arrayLength())); + } + else + { + sb.append(String.format(" self.%s = 0\n", propertyName)); + } + } + } + + sb.append("\n"); + generateCompositeEncodeDecode(sb, compositeName, tokens); + + out.append(sb); + } + } + + private void generateCompositeEncodeDecode( + final StringBuilder sb, + final String compositeName, + final List tokens) + { + final String byteOrder = ir.byteOrder() == ByteOrder.LITTLE_ENDIAN ? "<" : ">"; + + // Encode method + sb.append(" def encode(self, buffer: BytesIO) -> None:\n"); + sb.append(" \"\"\"Encode the composite to the buffer.\"\"\"\n"); + + for (int i = 1; i < tokens.size() - 1; i++) + { + final Token token = tokens.get(i); + if (token.signal() == Signal.ENCODING) + { + final String propertyName = formatPropertyName(token.name()); + final String structFormat = pythonStructFormat(token.encoding().primitiveType()); + + if (token.arrayLength() > 1) + { + sb.append(String.format( + " for val in self.%s:\n" + + " buffer.write(struct.pack('%s%s', val))\n", + propertyName, byteOrder, structFormat)); + } + else + { + sb.append(String.format( + " buffer.write(struct.pack('%s%s', self.%s))\n", + byteOrder, structFormat, propertyName)); + } + } + } + + sb.append("\n"); + + // Decode method + sb.append(" def decode(self, buffer: BytesIO) -> None:\n"); + sb.append(" \"\"\"Decode the composite from the buffer.\"\"\"\n"); + + for (int i = 1; i < tokens.size() - 1; i++) + { + final Token token = tokens.get(i); + if (token.signal() == Signal.ENCODING) + { + final String propertyName = formatPropertyName(token.name()); + final String structFormat = pythonStructFormat(token.encoding().primitiveType()); + final int size = primitiveTypeSize(token.encoding().primitiveType()); + + if (token.arrayLength() > 1) + { + sb.append(String.format( + " self.%s = []\n" + + " for _ in range(%d):\n" + + " self.%s.append(struct.unpack('%s%s', buffer.read(%d))[0])\n", + propertyName, token.arrayLength(), propertyName, byteOrder, structFormat, size)); + } + else + { + sb.append(String.format( + " self.%s = struct.unpack('%s%s', buffer.read(%d))[0]\n", + propertyName, byteOrder, structFormat, size)); + } + } + } + + sb.append("\n"); + sb.append(String.format(" @staticmethod\n")); + sb.append(String.format(" def encoded_length() -> int:\n")); + sb.append(String.format(" return %d\n", tokens.get(0).encodedLength())); + } + + private void generateMessageClass( + final StringBuilder sb, + final String className, + final List tokens) + { + final Token msgToken = tokens.get(0); + + sb.append(String.format("class %s:\n", className)); + sb.append(String.format(" \"\"\"SBE message: %s.\"\"\"\n\n", msgToken.name())); + sb.append(String.format(" TEMPLATE_ID = %d\n", msgToken.id())); + sb.append(String.format(" SCHEMA_ID = %d\n", ir.id())); + sb.append(String.format(" SCHEMA_VERSION = %d\n", ir.version())); + sb.append(String.format(" BLOCK_LENGTH = %d\n\n", msgToken.encodedLength())); + + // Constructor + sb.append(" def __init__(self):\n"); + + final List messageBody = tokens.subList(1, tokens.size() - 1); + final List fields = new ArrayList<>(); + int i = collectFields(messageBody, 0, fields); + + // Initialize fields + for (final Token fieldToken : fields) + { + if (fieldToken.signal() == Signal.BEGIN_FIELD) + { + final String propertyName = formatPropertyName(fieldToken.name()); + sb.append(String.format(" self.%s = None\n", propertyName)); + } + } + + final List groups = new ArrayList<>(); + i = collectGroups(messageBody, i, groups); + + for (int j = 0; j < groups.size();) + { + final Token groupToken = groups.get(j); + if (groupToken.signal() == Signal.BEGIN_GROUP) + { + final String propertyName = formatPropertyName(groupToken.name()); + sb.append(String.format(" self.%s = []\n", propertyName)); + j += groupToken.componentTokenCount(); + } + else + { + j++; + } + } + + final List varData = new ArrayList<>(); + collectVarData(messageBody, i, varData); + + for (int j = 0; j < varData.size();) + { + final Token varDataToken = varData.get(j); + if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) + { + final String propertyName = formatPropertyName(varDataToken.name()); + sb.append(String.format(" self.%s = b''\n", propertyName)); + j += varDataToken.componentTokenCount(); + } + else + { + j++; + } + } + + sb.append("\n"); + + generateMessageEncodeDecode(sb, className, tokens, fields, groups, varData); + } + + private void generateMessageEncodeDecode( + final StringBuilder sb, + final String className, + final List tokens, + final List fields, + final List groups, + final List varData) + { + final String byteOrder = ir.byteOrder() == ByteOrder.LITTLE_ENDIAN ? "<" : ">"; + + // Encode method + sb.append(" def encode(self) -> bytes:\n"); + sb.append(" \"\"\"Encode the message to bytes.\"\"\"\n"); + sb.append(" buffer = BytesIO()\n\n"); + + // Encode fields + for (int i = 0; i < fields.size(); i++) + { + final Token fieldToken = fields.get(i); + if (fieldToken.signal() == Signal.BEGIN_FIELD && i + 1 < fields.size()) + { + final Token encodingToken = fields.get(i + 1); + if (encodingToken.signal() == Signal.ENCODING) + { + final String propertyName = formatPropertyName(fieldToken.name()); + final String structFormat = pythonStructFormat(encodingToken.encoding().primitiveType()); + + if (encodingToken.arrayLength() > 1) + { + sb.append(String.format( + " if self.%s is not None:\n" + + " for val in self.%s:\n" + + " buffer.write(struct.pack('%s%s', val))\n", + propertyName, propertyName, byteOrder, structFormat)); + } + else + { + sb.append(String.format( + " if self.%s is not None:\n" + + " buffer.write(struct.pack('%s%s', self.%s))\n", + propertyName, byteOrder, structFormat, propertyName)); + } + } + i++; // Skip encoding token + } + } + + sb.append("\n return buffer.getvalue()\n\n"); + + // Decode method + sb.append(" def decode(self, data: bytes) -> None:\n"); + sb.append(" \"\"\"Decode the message from bytes.\"\"\"\n"); + sb.append(" buffer = BytesIO(data)\n\n"); + + // Decode fields + for (int i = 0; i < fields.size(); i++) + { + final Token fieldToken = fields.get(i); + if (fieldToken.signal() == Signal.BEGIN_FIELD && i + 1 < fields.size()) + { + final Token encodingToken = fields.get(i + 1); + if (encodingToken.signal() == Signal.ENCODING) + { + final String propertyName = formatPropertyName(fieldToken.name()); + final String structFormat = pythonStructFormat(encodingToken.encoding().primitiveType()); + final int size = primitiveTypeSize(encodingToken.encoding().primitiveType()); + + if (encodingToken.arrayLength() > 1) + { + sb.append(String.format( + " self.%s = []\n" + + " for _ in range(%d):\n" + + " self.%s.append(struct.unpack('%s%s', buffer.read(%d))[0])\n", + propertyName, encodingToken.arrayLength(), propertyName, byteOrder, structFormat, size)); + } + else + { + sb.append(String.format( + " self.%s = struct.unpack('%s%s', buffer.read(%d))[0]\n", + propertyName, byteOrder, structFormat, size)); + } + } + i++; // Skip encoding token + } + } + } +} diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonOutputManager.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonOutputManager.java new file mode 100644 index 0000000000..cdc42c5ab2 --- /dev/null +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonOutputManager.java @@ -0,0 +1,72 @@ +/* + * Copyright 2013-2025 Real Logic Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package uk.co.real_logic.sbe.generation.python; + +import org.agrona.generation.OutputManager; +import org.agrona.Verify; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; + +import static java.io.File.separatorChar; + +/** + * {@link OutputManager} for managing the creation of Python source files as the target of code generation. + * The character encoding for the {@link java.io.Writer} is UTF-8. + */ +public class PythonOutputManager implements OutputManager +{ + private final File outputDir; + + /** + * Create a new {@link OutputManager} for generating Python source files into a given package. + * + * @param baseDirName for the generated source code. + * @param namespaceName for the generated source code relative to the baseDirName. + */ + public PythonOutputManager(final String baseDirName, final String namespaceName) + { + Verify.notNull(baseDirName, "baseDirName"); + Verify.notNull(namespaceName, "applicableNamespace"); + + final String dirName = baseDirName.endsWith("" + separatorChar) ? baseDirName : baseDirName + separatorChar; + final String packageDirName = dirName + namespaceName.replace('.', '_').replace(' ', '_').replace('-', '_'); + + outputDir = new File(packageDirName); + if (!outputDir.exists() && !outputDir.mkdirs()) + { + throw new IllegalStateException("Unable to create directory: " + packageDirName); + } + } + + /** + * Create a new output which will be a Python source file in the given package. + *

+ * The {@link java.io.Writer} should be closed once the caller has finished with it. The Writer is + * buffered for efficient IO operations. + * + * @param name the name of the Python class. + * @return a {@link java.io.Writer} to which the source code should be written. + * @throws IOException if an issue occurs when creating the file. + */ + public Writer createOutput(final String name) throws IOException + { + final File targetFile = new File(outputDir, name + ".py"); + + return Files.newBufferedWriter(targetFile.toPath(), StandardCharsets.UTF_8); + } +} diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonUtil.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonUtil.java new file mode 100644 index 0000000000..abcbb54f20 --- /dev/null +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonUtil.java @@ -0,0 +1,159 @@ +/* + * Copyright 2013-2025 Real Logic Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package uk.co.real_logic.sbe.generation.python; + +import uk.co.real_logic.sbe.PrimitiveType; +import uk.co.real_logic.sbe.SbeTool; +import uk.co.real_logic.sbe.ValidationUtil; + +import java.util.EnumMap; +import java.util.Map; + +/** + * Utilities for mapping between IR and the Python language. + */ +public class PythonUtil +{ + private static final Map PRIMITIVE_TYPE_STRING_ENUM_MAP = new EnumMap<>(PrimitiveType.class); + + static + { + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.CHAR, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.INT8, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.INT16, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.INT32, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.INT64, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.UINT8, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.UINT16, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.UINT32, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.UINT64, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.FLOAT, "float"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.DOUBLE, "float"); + } + + /** + * Map the name of a {@link uk.co.real_logic.sbe.PrimitiveType} to a Python type name. + * + * @param primitiveType to map. + * @return the name of the Python type that most closely maps. + */ + public static String pythonTypeName(final PrimitiveType primitiveType) + { + return PRIMITIVE_TYPE_STRING_ENUM_MAP.get(primitiveType); + } + + private static final Map STRUCT_FORMAT_BY_PRIMITIVE_TYPE_MAP = + new EnumMap<>(PrimitiveType.class); + + static + { + STRUCT_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.CHAR, "B"); + STRUCT_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.INT8, "b"); + STRUCT_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.INT16, "h"); + STRUCT_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.INT32, "i"); + STRUCT_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.INT64, "q"); + STRUCT_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.UINT8, "B"); + STRUCT_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.UINT16, "H"); + STRUCT_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.UINT32, "I"); + STRUCT_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.UINT64, "Q"); + STRUCT_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.FLOAT, "f"); + STRUCT_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.DOUBLE, "d"); + } + + /** + * Map the name of a {@link uk.co.real_logic.sbe.PrimitiveType} to a Python struct format character. + * + * @param primitiveType to map. + * @return the struct format character. + */ + public static String pythonStructFormat(final PrimitiveType primitiveType) + { + return STRUCT_FORMAT_BY_PRIMITIVE_TYPE_MAP.get(primitiveType); + } + + /** + * Get the size in bytes of a primitive type. + * + * @param primitiveType to get size for. + * @return size in bytes. + */ + public static int primitiveTypeSize(final PrimitiveType primitiveType) + { + switch (primitiveType) + { + case CHAR: + case INT8: + case UINT8: + return 1; + case INT16: + case UINT16: + return 2; + case INT32: + case UINT32: + case FLOAT: + return 4; + case INT64: + case UINT64: + case DOUBLE: + return 8; + default: + throw new IllegalArgumentException("Unknown primitive type: " + primitiveType); + } + } + + /** + * Format a String as a property name (snake_case for Python). + * + * @param value to be formatted. + * @return the string formatted as a property name. + */ + public static String formatPropertyName(final String value) + { + // Convert camelCase to snake_case + String formattedValue = value.replaceAll("([a-z])([A-Z])", "$1_$2").toLowerCase(); + + if (ValidationUtil.isPythonKeyword(formattedValue)) + { + final String keywordAppendToken = System.getProperty(SbeTool.KEYWORD_APPEND_TOKEN); + if (null == keywordAppendToken) + { + throw new IllegalStateException( + "Invalid property name='" + formattedValue + + "' please correct the schema or consider setting system property: " + SbeTool.KEYWORD_APPEND_TOKEN); + } + + formattedValue += keywordAppendToken; + } + + return formattedValue; + } + + /** + * Format a String as a class name (PascalCase for Python). + * + * @param value to be formatted. + * @return the string formatted as a class name. + */ + public static String formatClassName(final String value) + { + // Ensure first character is uppercase + if (value == null || value.isEmpty()) + { + return value; + } + return Character.toUpperCase(value.charAt(0)) + value.substring(1); + } +} From 1eae6ae187517dbb4a48a1a33e8f5a6e7da9f008 Mon Sep 17 00:00:00 2001 From: Pablo Date: Mon, 15 Dec 2025 01:49:30 +0100 Subject: [PATCH 03/11] add php --- .../uk/co/real_logic/sbe/ValidationUtil.java | 88 ++++ .../generation/TargetCodeGeneratorLoader.java | 18 + .../sbe/generation/php/PHPGenerator.java | 466 ++++++++++++++++++ .../sbe/generation/php/PHPOutputManager.java | 72 +++ .../sbe/generation/php/PHPUtil.java | 157 ++++++ 5 files changed, 801 insertions(+) create mode 100644 sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPGenerator.java create mode 100644 sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPOutputManager.java create mode 100644 sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPUtil.java diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/ValidationUtil.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/ValidationUtil.java index 08ec1e5ceb..359ff73803 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/ValidationUtil.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/ValidationUtil.java @@ -598,4 +598,92 @@ private static boolean isSbePythonIdentifierPart(final char c) { return Character.isLetterOrDigit(c) || c == '_'; } + + /* https://www.php.net/manual/en/reserved.keywords.php */ + private static final Set PHP_KEYWORDS = Set.of( + "__halt_compiler", "abstract", "and", "array", "as", "break", "callable", "case", + "catch", "class", "clone", "const", "continue", "declare", "default", "die", + "do", "echo", "else", "elseif", "empty", "enddeclare", "endfor", "endforeach", + "endif", "endswitch", "endwhile", "eval", "exit", "extends", "final", "finally", + "fn", "for", "foreach", "function", "global", "goto", "if", "implements", + "include", "include_once", "instanceof", "insteadof", "interface", "isset", + "list", "match", "namespace", "new", "or", "print", "private", "protected", + "public", "readonly", "require", "require_once", "return", "static", "switch", + "throw", "trait", "try", "unset", "use", "var", "while", "xor", "yield", + "__CLASS__", "__DIR__", "__FILE__", "__FUNCTION__", "__LINE__", "__METHOD__", + "__NAMESPACE__", "__TRAIT__", "int", "float", "bool", "string", "true", + "false", "null", "void", "iterable", "object", "mixed", "never"); + + /** + * Check value for validity of usage as a PHP identifier. + * PHP identifiers + * + * @param value to check + * @return true for validity as a PHP name. false if not. + */ + public static boolean isSbePhpName(final String value) + { + if (possiblePhpKeyword(value)) + { + if (isPhpKeyword(value)) + { + return false; + } + } + else + { + return false; + } + + return true; + } + + /** + * Is the token a PHP language keyword? + * + * @param token to be checked. + * @return true if the token a PHP language keyword. + */ + public static boolean isPhpKeyword(final String token) + { + return PHP_KEYWORDS.contains(token); + } + + /** + * Is the value a possible PHP language keyword? + * + * @param value to be checked. + * @return true if the value is a possible PHP language keyword. + */ + private static boolean possiblePhpKeyword(final String value) + { + for (int i = 0, size = value.length(); i < size; i++) + { + final char c = value.charAt(i); + + if (i == 0 && isSbePhpIdentifierStart(c)) + { + continue; + } + + if (isSbePhpIdentifierPart(c)) + { + continue; + } + + return false; + } + + return true; + } + + private static boolean isSbePhpIdentifierStart(final char c) + { + return Character.isLetter(c) || c == '_'; + } + + private static boolean isSbePhpIdentifierPart(final char c) + { + return Character.isLetterOrDigit(c) || c == '_'; + } } diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/TargetCodeGeneratorLoader.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/TargetCodeGeneratorLoader.java index 831d982968..856863e4ec 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/TargetCodeGeneratorLoader.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/TargetCodeGeneratorLoader.java @@ -34,6 +34,8 @@ import uk.co.real_logic.sbe.generation.typescript.TypeScriptOutputManager; import uk.co.real_logic.sbe.generation.python.PythonGenerator; import uk.co.real_logic.sbe.generation.python.PythonOutputManager; +import uk.co.real_logic.sbe.generation.php.PHPGenerator; +import uk.co.real_logic.sbe.generation.php.PHPOutputManager; import uk.co.real_logic.sbe.ir.Ir; import static uk.co.real_logic.sbe.SbeTool.*; @@ -209,6 +211,22 @@ public CodeGenerator newInstance(final Ir ir, final String outputDir) ir, new PythonOutputManager(outputDir, ir.applicableNamespace())); } + }, + + /** + * Generates decoder codecs for the PHP programming language. + */ + PHP() + { + /** + * {@inheritDoc} + */ + public CodeGenerator newInstance(final Ir ir, final String outputDir) + { + return new PHPGenerator( + ir, + new PHPOutputManager(outputDir, ir.applicableNamespace())); + } }; /** diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPGenerator.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPGenerator.java new file mode 100644 index 0000000000..ec800471fa --- /dev/null +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPGenerator.java @@ -0,0 +1,466 @@ +/* + * Copyright 2013-2025 Real Logic Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package uk.co.real_logic.sbe.generation.php; + +import uk.co.real_logic.sbe.generation.CodeGenerator; +import org.agrona.generation.OutputManager; +import uk.co.real_logic.sbe.ir.*; +import org.agrona.Verify; + +import java.io.IOException; +import java.io.Writer; +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.List; + +import static uk.co.real_logic.sbe.generation.php.PHPUtil.*; +import static uk.co.real_logic.sbe.ir.GenerationUtil.collectVarData; +import static uk.co.real_logic.sbe.ir.GenerationUtil.collectGroups; +import static uk.co.real_logic.sbe.ir.GenerationUtil.collectFields; + +/** + * Codec generator for the PHP programming language. + */ +@SuppressWarnings("MethodLength") +public class PHPGenerator implements CodeGenerator +{ + private final Ir ir; + private final OutputManager outputManager; + + /** + * Create a new PHP language {@link CodeGenerator}. + * + * @param ir for the messages and types. + * @param outputManager for generating the codecs to. + */ + public PHPGenerator(final Ir ir, final OutputManager outputManager) + { + Verify.notNull(ir, "ir"); + Verify.notNull(outputManager, "outputManager"); + + this.ir = ir; + this.outputManager = outputManager; + } + + /** + * {@inheritDoc} + */ + public void generate() throws IOException + { + generateTypeStubs(); + + for (final List tokens : ir.messages()) + { + final Token msgToken = tokens.get(0); + final String className = formatClassName(msgToken.name()); + + try (Writer out = outputManager.createOutput(className)) + { + final StringBuilder sb = new StringBuilder(); + + generateFileHeader(sb); + generateMessageClass(sb, className, tokens); + + out.append(sb); + } + } + } + + private void generateFileHeader(final StringBuilder sb) + { + sb.append(" tokens : ir.types()) + { + switch (tokens.get(0).signal()) + { + case BEGIN_ENUM: + generateEnum(tokens); + break; + + case BEGIN_SET: + generateChoiceSet(tokens); + break; + + case BEGIN_COMPOSITE: + generateComposite(tokens); + break; + + default: + break; + } + } + } + + private void generateEnum(final List tokens) throws IOException + { + final Token enumToken = tokens.get(0); + final String enumName = formatClassName(enumToken.applicableTypeName()); + + try (Writer out = outputManager.createOutput(enumName)) + { + final StringBuilder sb = new StringBuilder(); + + generateFileHeader(sb); + + sb.append(String.format("class %s\n{\n", enumName)); + + for (int i = 1; i < tokens.size() - 1; i++) + { + final Token token = tokens.get(i); + final String name = formatPropertyName(token.name()).toUpperCase(); + final String value = token.encoding().constValue().toString(); + sb.append(String.format(" public const %s = %s;\n", name, value)); + } + + // Add null value + final String nullValue = enumToken.encoding().applicableNullValue().toString(); + sb.append(String.format(" public const NULL_VALUE = %s;\n\n", nullValue)); + + // Add size method + sb.append(" public static function encodedLength(): int\n"); + sb.append(" {\n"); + sb.append(String.format(" return %d;\n", enumToken.encodedLength())); + sb.append(" }\n"); + sb.append("}\n"); + + out.append(sb); + } + } + + private void generateChoiceSet(final List tokens) throws IOException + { + final Token choiceToken = tokens.get(0); + final String choiceName = formatClassName(choiceToken.applicableTypeName()); + + try (Writer out = outputManager.createOutput(choiceName)) + { + final StringBuilder sb = new StringBuilder(); + + generateFileHeader(sb); + + sb.append(String.format("class %s\n{\n", choiceName)); + + for (int i = 1; i < tokens.size() - 1; i++) + { + final Token token = tokens.get(i); + final String name = formatPropertyName(token.name()).toUpperCase(); + final String value = token.encoding().constValue().toString(); + sb.append(String.format(" public const %s = %s;\n", name, value)); + } + + sb.append("\n"); + sb.append(" public static function encodedLength(): int\n"); + sb.append(" {\n"); + sb.append(String.format(" return %d;\n", choiceToken.encodedLength())); + sb.append(" }\n"); + sb.append("}\n"); + + out.append(sb); + } + } + + private void generateComposite(final List tokens) throws IOException + { + final Token compositeToken = tokens.get(0); + final String compositeName = formatClassName(compositeToken.applicableTypeName()); + + try (Writer out = outputManager.createOutput(compositeName)) + { + final StringBuilder sb = new StringBuilder(); + + generateFileHeader(sb); + + sb.append(String.format("class %s\n{\n", compositeName)); + + // Declare properties + for (int i = 1; i < tokens.size() - 1; i++) + { + final Token token = tokens.get(i); + if (token.signal() == Signal.ENCODING) + { + final String propertyName = formatPropertyName(token.name()); + if (token.arrayLength() > 1) + { + sb.append(String.format(" public array $%s = [];\n", propertyName)); + } + else + { + sb.append(String.format(" public int|float $%s = 0;\n", propertyName)); + } + } + } + + sb.append("\n"); + generateCompositeEncodeDecode(sb, compositeName, tokens); + + out.append(sb); + } + } + + private void generateCompositeEncodeDecode( + final StringBuilder sb, + final String compositeName, + final List tokens) + { + final String byteOrder = ir.byteOrder() == ByteOrder.LITTLE_ENDIAN ? "<" : ">"; + + // Encode method + sb.append(" public function encode(): string\n"); + sb.append(" {\n"); + sb.append(" $buffer = '';\n\n"); + + for (int i = 1; i < tokens.size() - 1; i++) + { + final Token token = tokens.get(i); + if (token.signal() == Signal.ENCODING) + { + final String propertyName = formatPropertyName(token.name()); + final String packFormat = phpPackFormat(token.encoding().primitiveType()); + + if (token.arrayLength() > 1) + { + sb.append(String.format( + " foreach ($this->%s as $val) {\n" + + " $buffer .= pack('%s', $val);\n" + + " }\n", + propertyName, packFormat)); + } + else + { + sb.append(String.format( + " $buffer .= pack('%s', $this->%s);\n", + packFormat, propertyName)); + } + } + } + + sb.append("\n return $buffer;\n"); + sb.append(" }\n\n"); + + // Decode method + sb.append(" public function decode(string $data, int &$offset = 0): void\n"); + sb.append(" {\n"); + + for (int i = 1; i < tokens.size() - 1; i++) + { + final Token token = tokens.get(i); + if (token.signal() == Signal.ENCODING) + { + final String propertyName = formatPropertyName(token.name()); + final String packFormat = phpPackFormat(token.encoding().primitiveType()); + final int size = primitiveTypeSize(token.encoding().primitiveType()); + + if (token.arrayLength() > 1) + { + sb.append(String.format( + " $this->%s = [];\n" + + " for ($i = 0; $i < %d; $i++) {\n" + + " $this->%s[] = unpack('%s', substr($data, $offset, %d))[1];\n" + + " $offset += %d;\n" + + " }\n", + propertyName, token.arrayLength(), propertyName, packFormat, size, size)); + } + else + { + sb.append(String.format( + " $this->%s = unpack('%s', substr($data, $offset, %d))[1];\n" + + " $offset += %d;\n", + propertyName, packFormat, size, size)); + } + } + } + + sb.append(" }\n\n"); + + sb.append(" public static function encodedLength(): int\n"); + sb.append(" {\n"); + sb.append(String.format(" return %d;\n", tokens.get(0).encodedLength())); + sb.append(" }\n"); + sb.append("}\n"); + } + + private void generateMessageClass( + final StringBuilder sb, + final String className, + final List tokens) + { + final Token msgToken = tokens.get(0); + + sb.append(String.format("class %s\n{\n", className)); + sb.append(String.format(" public const TEMPLATE_ID = %d;\n", msgToken.id())); + sb.append(String.format(" public const SCHEMA_ID = %d;\n", ir.id())); + sb.append(String.format(" public const SCHEMA_VERSION = %d;\n", ir.version())); + sb.append(String.format(" public const BLOCK_LENGTH = %d;\n\n", msgToken.encodedLength())); + + final List messageBody = tokens.subList(1, tokens.size() - 1); + final List fields = new ArrayList<>(); + int i = collectFields(messageBody, 0, fields); + + // Declare properties + for (final Token fieldToken : fields) + { + if (fieldToken.signal() == Signal.BEGIN_FIELD) + { + final String propertyName = formatPropertyName(fieldToken.name()); + sb.append(String.format(" public int|float|array|null $%s = null;\n", propertyName)); + } + } + + final List groups = new ArrayList<>(); + i = collectGroups(messageBody, i, groups); + + for (int j = 0; j < groups.size();) + { + final Token groupToken = groups.get(j); + if (groupToken.signal() == Signal.BEGIN_GROUP) + { + final String propertyName = formatPropertyName(groupToken.name()); + sb.append(String.format(" public array $%s = [];\n", propertyName)); + j += groupToken.componentTokenCount(); + } + else + { + j++; + } + } + + final List varData = new ArrayList<>(); + collectVarData(messageBody, i, varData); + + for (int j = 0; j < varData.size();) + { + final Token varDataToken = varData.get(j); + if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) + { + final String propertyName = formatPropertyName(varDataToken.name()); + sb.append(String.format(" public string $%s = '';\n", propertyName)); + j += varDataToken.componentTokenCount(); + } + else + { + j++; + } + } + + sb.append("\n"); + + generateMessageEncodeDecode(sb, className, tokens, fields, groups, varData); + } + + private void generateMessageEncodeDecode( + final StringBuilder sb, + final String className, + final List tokens, + final List fields, + final List groups, + final List varData) + { + final String byteOrder = ir.byteOrder() == ByteOrder.LITTLE_ENDIAN ? "<" : ">"; + + // Encode method + sb.append(" public function encode(): string\n"); + sb.append(" {\n"); + sb.append(" $buffer = '';\n\n"); + + // Encode fields + for (int i = 0; i < fields.size(); i++) + { + final Token fieldToken = fields.get(i); + if (fieldToken.signal() == Signal.BEGIN_FIELD && i + 1 < fields.size()) + { + final Token encodingToken = fields.get(i + 1); + if (encodingToken.signal() == Signal.ENCODING) + { + final String propertyName = formatPropertyName(fieldToken.name()); + final String packFormat = phpPackFormat(encodingToken.encoding().primitiveType()); + + if (encodingToken.arrayLength() > 1) + { + sb.append(String.format( + " if ($this->%s !== null) {\n" + + " foreach ($this->%s as $val) {\n" + + " $buffer .= pack('%s', $val);\n" + + " }\n" + + " }\n", + propertyName, propertyName, packFormat)); + } + else + { + sb.append(String.format( + " if ($this->%s !== null) {\n" + + " $buffer .= pack('%s', $this->%s);\n" + + " }\n", + propertyName, packFormat, propertyName)); + } + } + i++; // Skip encoding token + } + } + + sb.append("\n return $buffer;\n"); + sb.append(" }\n\n"); + + // Decode method + sb.append(" public function decode(string $data): void\n"); + sb.append(" {\n"); + sb.append(" $offset = 0;\n\n"); + + // Decode fields + for (int i = 0; i < fields.size(); i++) + { + final Token fieldToken = fields.get(i); + if (fieldToken.signal() == Signal.BEGIN_FIELD && i + 1 < fields.size()) + { + final Token encodingToken = fields.get(i + 1); + if (encodingToken.signal() == Signal.ENCODING) + { + final String propertyName = formatPropertyName(fieldToken.name()); + final String packFormat = phpPackFormat(encodingToken.encoding().primitiveType()); + final int size = primitiveTypeSize(encodingToken.encoding().primitiveType()); + + if (encodingToken.arrayLength() > 1) + { + sb.append(String.format( + " $this->%s = [];\n" + + " for ($i = 0; $i < %d; $i++) {\n" + + " $this->%s[] = unpack('%s', substr($data, $offset, %d))[1];\n" + + " $offset += %d;\n" + + " }\n", + propertyName, encodingToken.arrayLength(), propertyName, packFormat, size, size)); + } + else + { + sb.append(String.format( + " $this->%s = unpack('%s', substr($data, $offset, %d))[1];\n" + + " $offset += %d;\n", + propertyName, packFormat, size, size)); + } + } + i++; // Skip encoding token + } + } + + sb.append(" }\n"); + sb.append("}\n"); + } +} diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPOutputManager.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPOutputManager.java new file mode 100644 index 0000000000..e78dd4b514 --- /dev/null +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPOutputManager.java @@ -0,0 +1,72 @@ +/* + * Copyright 2013-2025 Real Logic Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package uk.co.real_logic.sbe.generation.php; + +import org.agrona.generation.OutputManager; +import org.agrona.Verify; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; + +import static java.io.File.separatorChar; + +/** + * {@link OutputManager} for managing the creation of PHP source files as the target of code generation. + * The character encoding for the {@link java.io.Writer} is UTF-8. + */ +public class PHPOutputManager implements OutputManager +{ + private final File outputDir; + + /** + * Create a new {@link OutputManager} for generating PHP source files into a given package. + * + * @param baseDirName for the generated source code. + * @param namespaceName for the generated source code relative to the baseDirName. + */ + public PHPOutputManager(final String baseDirName, final String namespaceName) + { + Verify.notNull(baseDirName, "baseDirName"); + Verify.notNull(namespaceName, "applicableNamespace"); + + final String dirName = baseDirName.endsWith("" + separatorChar) ? baseDirName : baseDirName + separatorChar; + final String packageDirName = dirName + namespaceName.replace('.', '_').replace(' ', '_').replace('-', '_'); + + outputDir = new File(packageDirName); + if (!outputDir.exists() && !outputDir.mkdirs()) + { + throw new IllegalStateException("Unable to create directory: " + packageDirName); + } + } + + /** + * Create a new output which will be a PHP source file in the given package. + *

+ * The {@link java.io.Writer} should be closed once the caller has finished with it. The Writer is + * buffered for efficient IO operations. + * + * @param name the name of the PHP class. + * @return a {@link java.io.Writer} to which the source code should be written. + * @throws IOException if an issue occurs when creating the file. + */ + public Writer createOutput(final String name) throws IOException + { + final File targetFile = new File(outputDir, name + ".php"); + + return Files.newBufferedWriter(targetFile.toPath(), StandardCharsets.UTF_8); + } +} diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPUtil.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPUtil.java new file mode 100644 index 0000000000..fdc65e2cb8 --- /dev/null +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPUtil.java @@ -0,0 +1,157 @@ +/* + * Copyright 2013-2025 Real Logic Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package uk.co.real_logic.sbe.generation.php; + +import uk.co.real_logic.sbe.PrimitiveType; +import uk.co.real_logic.sbe.SbeTool; +import uk.co.real_logic.sbe.ValidationUtil; + +import java.util.EnumMap; +import java.util.Map; + +/** + * Utilities for mapping between IR and the PHP language. + */ +public class PHPUtil +{ + private static final Map PRIMITIVE_TYPE_STRING_ENUM_MAP = new EnumMap<>(PrimitiveType.class); + + static + { + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.CHAR, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.INT8, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.INT16, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.INT32, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.INT64, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.UINT8, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.UINT16, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.UINT32, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.UINT64, "int"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.FLOAT, "float"); + PRIMITIVE_TYPE_STRING_ENUM_MAP.put(PrimitiveType.DOUBLE, "float"); + } + + /** + * Map the name of a {@link uk.co.real_logic.sbe.PrimitiveType} to a PHP type name. + * + * @param primitiveType to map. + * @return the name of the PHP type that most closely maps. + */ + public static String phpTypeName(final PrimitiveType primitiveType) + { + return PRIMITIVE_TYPE_STRING_ENUM_MAP.get(primitiveType); + } + + private static final Map PACK_FORMAT_BY_PRIMITIVE_TYPE_MAP = + new EnumMap<>(PrimitiveType.class); + + static + { + PACK_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.CHAR, "C"); + PACK_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.INT8, "c"); + PACK_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.INT16, "s"); + PACK_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.INT32, "l"); + PACK_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.INT64, "q"); + PACK_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.UINT8, "C"); + PACK_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.UINT16, "v"); + PACK_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.UINT32, "V"); + PACK_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.UINT64, "P"); + PACK_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.FLOAT, "f"); + PACK_FORMAT_BY_PRIMITIVE_TYPE_MAP.put(PrimitiveType.DOUBLE, "d"); + } + + /** + * Map the name of a {@link uk.co.real_logic.sbe.PrimitiveType} to a PHP pack() format character. + * + * @param primitiveType to map. + * @return the pack format character. + */ + public static String phpPackFormat(final PrimitiveType primitiveType) + { + return PACK_FORMAT_BY_PRIMITIVE_TYPE_MAP.get(primitiveType); + } + + /** + * Get the size in bytes of a primitive type. + * + * @param primitiveType to get size for. + * @return size in bytes. + */ + public static int primitiveTypeSize(final PrimitiveType primitiveType) + { + switch (primitiveType) + { + case CHAR: + case INT8: + case UINT8: + return 1; + case INT16: + case UINT16: + return 2; + case INT32: + case UINT32: + case FLOAT: + return 4; + case INT64: + case UINT64: + case DOUBLE: + return 8; + default: + throw new IllegalArgumentException("Unknown primitive type: " + primitiveType); + } + } + + /** + * Format a String as a property name (camelCase for PHP). + * + * @param value to be formatted. + * @return the string formatted as a property name. + */ + public static String formatPropertyName(final String value) + { + String formattedValue = value; + + if (ValidationUtil.isPhpKeyword(formattedValue)) + { + final String keywordAppendToken = System.getProperty(SbeTool.KEYWORD_APPEND_TOKEN); + if (null == keywordAppendToken) + { + throw new IllegalStateException( + "Invalid property name='" + formattedValue + + "' please correct the schema or consider setting system property: " + SbeTool.KEYWORD_APPEND_TOKEN); + } + + formattedValue += keywordAppendToken; + } + + return formattedValue; + } + + /** + * Format a String as a class name (PascalCase for PHP). + * + * @param value to be formatted. + * @return the string formatted as a class name. + */ + public static String formatClassName(final String value) + { + if (value == null || value.isEmpty()) + { + return value; + } + return Character.toUpperCase(value.charAt(0)) + value.substring(1); + } +} From e218885334e700c42b3e4db378f0ef374cd9cdb9 Mon Sep 17 00:00:00 2001 From: Pablo Date: Mon, 15 Dec 2025 02:18:39 +0100 Subject: [PATCH 04/11] update readme --- README.md | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ce55a80bb2..acd855f9ee 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ Simple Binary Encoding (SBE) [![Actions Status](https://github.com/aeron-io/simple-binary-encoding/workflows/Continuous%20Integration/badge.svg)](https://github.com/aeron-io/simple-binary-encoding/actions) [![CodeQL Status](https://github.com/aeron-io/simple-binary-encoding/workflows/CodeQL/badge.svg)](https://github.com/aeron-io/simple-binary-encoding/actions) -[SBE](https://github.com/FIXTradingCommunity/fix-simple-binary-encoding) is an OSI layer 6 presentation for -encoding and decoding binary application messages for low-latency financial applications. This repository contains -the reference implementations in Java, C++, Golang, C#, and Rust. +[SBE](https://github.com/FIXTradingCommunity/fix-simple-binary-encoding) is an OSI layer 6 presentation for +encoding and decoding binary application messages for low-latency financial applications. This repository contains +the reference implementations in Java, C++, Golang, C#, Rust, Python, TypeScript, and PHP. More details on the design and usage of SBE can be found on the [Wiki](https://github.com/aeron-io/simple-binary-encoding/wiki). @@ -114,7 +114,7 @@ Developers wishing to enhance the CSharp generator should see the [developer doc Rust Build ------------ The SBE Rust generator will produce 100% safe rust crates (no `unsafe` code will be generated). Generated crates do -not have any dependencies on any libraries (including no SBE libraries). If you don't yet have Rust installed +not have any dependencies on any libraries (including no SBE libraries). If you don't yet have Rust installed see [Rust: Getting Started](https://www.rust-lang.org/learn/get-started) Generate the Rust codecs @@ -130,6 +130,36 @@ Or run test directly with `Cargo` $ cd rust $ cargo test +Python Generator +---------------- +The SBE Python generator creates Python classes with encode/decode methods using the `struct` module for binary +serialization. Generated code uses modern Python 3.8+ features including type hints. + +Generate Python codecs: + + $ java -Dsbe.output.dir=output/python -Dsbe.target.language=PYTHON -jar sbe-all/build/libs/sbe-all-${SBE_TOOL_VERSION}.jar schema.xml + +If your schema contains Python keywords (like `break`, `return`, etc.), use the keyword append token: + + $ java -Dsbe.output.dir=output/python -Dsbe.target.language=PYTHON -Dsbe.keyword.append.token=_ -jar sbe-all/build/libs/sbe-all-${SBE_TOOL_VERSION}.jar schema.xml + +PHP Generator +------------- +The SBE PHP generator creates PHP classes with encode/decode methods using the `pack()` and `unpack()` functions. +Generated code uses modern PHP 8.0+ features including union types and typed properties. + +Generate PHP codecs: + + $ java -Dsbe.output.dir=output/php -Dsbe.target.language=PHP -jar sbe-all/build/libs/sbe-all-${SBE_TOOL_VERSION}.jar schema.xml + +TypeScript Generator +-------------------- +The SBE TypeScript generator creates TypeScript interfaces and classes for encoding/decoding SBE messages. + +Generate TypeScript codecs: + + $ java -Dsbe.output.dir=output/typescript -Dsbe.target.language=TYPESCRIPT -jar sbe-all/build/libs/sbe-all-${SBE_TOOL_VERSION}.jar schema.xml + License (See LICENSE file for full license) ------------------------------------------- Copyright 2013-2025 Real Logic Limited. From 0230ab736963e14a928556ef196c94011ac7da24 Mon Sep 17 00:00:00 2001 From: Pablo Date: Tue, 16 Dec 2025 01:36:37 +0100 Subject: [PATCH 05/11] fix typescript --- .../typescript/TypeScriptGenerator.java | 57 +++++++++++++++---- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java index 706a97b66e..ad69bfeac4 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java @@ -440,7 +440,10 @@ private void generateMessageDecoder( final String interfaceName = messageName; final String decoderName = messageName + "Decoder"; - // Generate interface first + // Generate group interfaces FIRST, before any class declarations + generateGroupInterfaces(sb, groups); + + // Generate message interface generateMessageInterface(sb, interfaceName, fields, groups, varData); sb.append("\n"); @@ -696,16 +699,12 @@ else if ("UTF-8".equals(characterEncoding)) } /** - * Generate group decoder methods. + * Generate group interfaces (must be called before class declarations). * - * @param sb to append to. - * @param groups the group tokens. - * @param parentName the parent message name. + * @param sb to append to. + * @param groups the group tokens. */ - private void generateGroupDecoderMethods( - final StringBuilder sb, - final List groups, - final String parentName) + private void generateGroupInterfaces(final StringBuilder sb, final List groups) { for (int i = 0; i < groups.size();) { @@ -721,11 +720,10 @@ private void generateGroupDecoderMethods( groupTokens.add(groups.get(j)); } - // First, generate the interface for the group final List groupBody = groupTokens.subList(1, groupTokens.size() - 1); // Generate group interface - sb.append("\nexport interface ").append(groupName).append(" {\n"); + sb.append("export interface ").append(groupName).append(" {\n"); Generators.forEachField(groupBody, (fieldToken, typeToken) -> { @@ -736,6 +734,43 @@ private void generateGroupDecoderMethods( sb.append("}\n\n"); + i = endIndex; + } + else + { + i++; + } + } + } + + /** + * Generate group decoder methods. + * + * @param sb to append to. + * @param groups the group tokens. + * @param parentName the parent message name. + */ + private void generateGroupDecoderMethods( + final StringBuilder sb, + final List groups, + final String parentName) + { + for (int i = 0; i < groups.size();) + { + final Token groupToken = groups.get(i); + if (groupToken.signal() == Signal.BEGIN_GROUP) + { + final String groupName = formatTypeName(groupToken.name()); + final List groupTokens = new ArrayList<>(); + + final int endIndex = i + groupToken.componentTokenCount(); + for (int j = i; j < endIndex; j++) + { + groupTokens.add(groups.get(j)); + } + + final List groupBody = groupTokens.subList(1, groupTokens.size() - 1); + // Generate group decoder method final String methodName = "decode" + groupName + "Group"; sb.append(" private ").append(methodName) From 0445af1564058a5719dd593488b6cc408bbcab40 Mon Sep 17 00:00:00 2001 From: Pablo Date: Sun, 4 Jan 2026 19:00:46 -0500 Subject: [PATCH 06/11] applied fix for typescript --- .../typescript/TypeScriptGenerator.java | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java index ad69bfeac4..2d202191d4 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java @@ -779,11 +779,29 @@ private void generateGroupDecoderMethods( sb.append(" let pos = offset;\n\n"); - // Read group header - sb.append(" const blockLength = view.getUint16(pos, this.littleEndian);\n"); - sb.append(" pos += 2;\n"); - sb.append(" const numInGroup = view.getUint16(pos, this.littleEndian);\n"); - sb.append(" pos += 2;\n\n"); + // Read group header - get dimension encoding from tokens + final Token blockLengthToken = Generators.findFirst("blockLength", groupTokens, 0); + final Token numInGroupToken = Generators.findFirst("numInGroup", groupTokens, 0); + final PrimitiveType blockLengthType = blockLengthToken.encoding().primitiveType(); + final PrimitiveType numInGroupType = numInGroupToken.encoding().primitiveType(); + + sb.append(" const blockLength = view.").append(dataViewMethod(blockLengthType)) + .append("(pos"); + if (needsEndianness(blockLengthType)) + { + sb.append(", this.littleEndian"); + } + sb.append(");\n"); + sb.append(" pos += ").append(blockLengthToken.encodedLength()).append(";\n"); + + sb.append(" const numInGroup = view.").append(dataViewMethod(numInGroupType)) + .append("(pos"); + if (needsEndianness(numInGroupType)) + { + sb.append(", this.littleEndian"); + } + sb.append(");\n"); + sb.append(" pos += ").append(numInGroupToken.encodedLength()).append(";\n\n"); sb.append(" const items: ").append(groupName).append("[] = [];\n\n"); From 5eeb58fa20727d76f1ee9d9c91eb0a262a75cbc7 Mon Sep 17 00:00:00 2001 From: Pablo Date: Sat, 24 Jan 2026 14:36:24 +0100 Subject: [PATCH 07/11] fix typesript duplicate --- .../typescript/TypeScriptGenerator.java | 188 ++++++++++++------ 1 file changed, 131 insertions(+), 57 deletions(-) diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java index 2d202191d4..0844bcd977 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java @@ -511,12 +511,17 @@ private void generateMessageInterface( { sb.append("export interface ").append(interfaceName).append(" {\n"); + final java.util.Set seenFieldNames = new java.util.HashSet<>(); + // Fields Generators.forEachField(fields, (fieldToken, typeToken) -> { final String fieldName = formatFieldName(fieldToken.name()); - final String typeName = typeScriptTypeName(typeToken.encoding().primitiveType()); - sb.append(" ").append(fieldName).append(": ").append(typeName).append(";\n"); + if (seenFieldNames.add(fieldName)) + { + final String typeName = typeScriptTypeName(typeToken.encoding().primitiveType()); + sb.append(" ").append(fieldName).append(": ").append(typeName).append(";\n"); + } }); // Groups @@ -527,7 +532,10 @@ private void generateMessageInterface( { final String groupName = formatTypeName(groupToken.name()); final String fieldName = formatFieldName(groupToken.name()); - sb.append(" ").append(fieldName).append(": ").append(groupName).append("[];\n"); + if (seenFieldNames.add(fieldName)) + { + sb.append(" ").append(fieldName).append(": ").append(groupName).append("[];\n"); + } i += groupToken.componentTokenCount(); } @@ -544,16 +552,19 @@ private void generateMessageInterface( if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) { final String fieldName = formatFieldName(varDataToken.name()); - final Encoding encoding = varDataToken.encoding(); - final String characterEncoding = encoding.characterEncoding(); - - if (null == characterEncoding) - { - sb.append(" ").append(fieldName).append(": Uint8Array;\n"); - } - else + if (seenFieldNames.add(fieldName)) { - sb.append(" ").append(fieldName).append(": string;\n"); + final Encoding encoding = varDataToken.encoding(); + final String characterEncoding = encoding.characterEncoding(); + + if (null == characterEncoding) + { + sb.append(" ").append(fieldName).append(": Uint8Array;\n"); + } + else + { + sb.append(" ").append(fieldName).append(": string;\n"); + } } i += varDataToken.componentTokenCount(); @@ -592,27 +603,37 @@ private void generateDecodeMethod( // Decode fields final List fieldNames = new ArrayList<>(); final List fieldValues = new ArrayList<>(); + final java.util.Set seenFieldNames = new java.util.HashSet<>(); Generators.forEachField(fields, (fieldToken, typeToken) -> { final String fieldName = formatFieldName(fieldToken.name()); - fieldNames.add(fieldName); - final PrimitiveType primitiveType = typeToken.encoding().primitiveType(); - final String dataViewMethod = dataViewMethod(primitiveType); + if (seenFieldNames.add(fieldName)) + { + fieldNames.add(fieldName); - sb.append(" const ").append(fieldName).append(" = view.") - .append(dataViewMethod).append("(pos"); + final PrimitiveType primitiveType = typeToken.encoding().primitiveType(); + final String dataViewMethod = dataViewMethod(primitiveType); - if (needsEndianness(primitiveType)) - { - sb.append(", this.littleEndian"); - } + sb.append(" const ").append(fieldName).append(" = view.") + .append(dataViewMethod).append("(pos"); - sb.append(");\n"); - sb.append(" pos += ").append(typeToken.encodedLength()).append(";\n\n"); + if (needsEndianness(primitiveType)) + { + sb.append(", this.littleEndian"); + } - fieldValues.add(fieldName); + sb.append(");\n"); + sb.append(" pos += ").append(typeToken.encodedLength()).append(";\n\n"); + + fieldValues.add(fieldName); + } + else + { + // Skip duplicate field - just advance position + sb.append(" pos += ").append(typeToken.encodedLength()).append(";\n\n"); + } }); // Skip to block end for forward compatibility @@ -627,14 +648,26 @@ private void generateDecodeMethod( { final String groupName = formatTypeName(groupToken.name()); final String fieldName = formatFieldName(groupToken.name()); - final String methodName = "decode" + groupName + "Group"; - sb.append(" const ").append(fieldName).append(" = this.") - .append(methodName).append("(view, pos);\n"); - sb.append(" pos = ").append(fieldName).append(".nextOffset;\n\n"); + if (seenFieldNames.add(fieldName)) + { + final String methodName = "decode" + groupName + "Group"; - fieldNames.add(fieldName); - fieldValues.add(fieldName + ".items"); + sb.append(" const ").append(fieldName).append(" = this.") + .append(methodName).append("(view, pos);\n"); + sb.append(" pos = ").append(fieldName).append(".nextOffset;\n\n"); + + fieldNames.add(fieldName); + fieldValues.add(fieldName + ".items"); + } + else + { + // Duplicate group - skip decoding + final String methodName = "decode" + groupName + "Group"; + sb.append(" const ").append(fieldName).append("_dup = this.") + .append(methodName).append("(view, pos);\n"); + sb.append(" pos = ").append(fieldName).append("_dup.nextOffset;\n\n"); + } i += groupToken.componentTokenCount(); } @@ -651,26 +684,53 @@ private void generateDecodeMethod( if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) { final String fieldName = formatFieldName(varDataToken.name()); - final Encoding encoding = varDataToken.encoding(); - final String characterEncoding = encoding.characterEncoding(); - if (null == characterEncoding) + if (seenFieldNames.add(fieldName)) { - sb.append(" const ").append(fieldName).append(" = this.decodeVarData(view, pos);\n"); - } - else if ("UTF-8".equals(characterEncoding)) - { - sb.append(" const ").append(fieldName).append(" = this.decodeVarStringUtf8(view, pos);\n"); + final Encoding encoding = varDataToken.encoding(); + final String characterEncoding = encoding.characterEncoding(); + + if (null == characterEncoding) + { + sb.append(" const ").append(fieldName).append(" = this.decodeVarData(view, pos);\n"); + } + else if ("UTF-8".equals(characterEncoding)) + { + sb.append(" const ").append(fieldName).append(" = this.decodeVarStringUtf8(view, pos);\n"); + } + else + { + sb.append(" const ").append(fieldName).append(" = this.decodeVarStringAscii(view, pos);\n"); + } + + sb.append(" pos = ").append(fieldName).append(".nextOffset;\n\n"); + + fieldNames.add(fieldName); + fieldValues.add(fieldName + ".value"); } else { - sb.append(" const ").append(fieldName).append(" = this.decodeVarStringAscii(view, pos);\n"); - } + // Duplicate vardata - skip decoding + final Encoding encoding = varDataToken.encoding(); + final String characterEncoding = encoding.characterEncoding(); - sb.append(" pos = ").append(fieldName).append(".nextOffset;\n\n"); + if (null == characterEncoding) + { + sb.append(" const ").append(fieldName).append("_dup = this.decodeVarData(view, pos);\n"); + } + else if ("UTF-8".equals(characterEncoding)) + { + sb.append(" const ").append(fieldName) + .append("_dup = this.decodeVarStringUtf8(view, pos);\n"); + } + else + { + sb.append(" const ").append(fieldName) + .append("_dup = this.decodeVarStringAscii(view, pos);\n"); + } - fieldNames.add(fieldName); - fieldValues.add(fieldName + ".value"); + sb.append(" pos = ").append(fieldName).append("_dup.nextOffset;\n\n"); + } i += varDataToken.componentTokenCount(); } @@ -725,11 +785,15 @@ private void generateGroupInterfaces(final StringBuilder sb, final List g // Generate group interface sb.append("export interface ").append(groupName).append(" {\n"); + final java.util.Set seenFieldNames = new java.util.HashSet<>(); Generators.forEachField(groupBody, (fieldToken, typeToken) -> { final String fieldName = formatFieldName(fieldToken.name()); - final String typeName = typeScriptTypeName(typeToken.encoding().primitiveType()); - sb.append(" ").append(fieldName).append(": ").append(typeName).append(";\n"); + if (seenFieldNames.add(fieldName)) + { + final String typeName = typeScriptTypeName(typeToken.encoding().primitiveType()); + sb.append(" ").append(fieldName).append(": ").append(typeName).append(";\n"); + } }); sb.append("}\n\n"); @@ -811,27 +875,37 @@ private void generateGroupDecoderMethods( // Decode group fields final List groupFieldNames = new ArrayList<>(); final List groupFieldValues = new ArrayList<>(); + final java.util.Set seenFieldNames = new java.util.HashSet<>(); Generators.forEachField(groupBody, (fieldToken, typeToken) -> { final String fieldName = formatFieldName(fieldToken.name()); - groupFieldNames.add(fieldName); - final PrimitiveType primitiveType = typeToken.encoding().primitiveType(); - final String dataViewMethod = dataViewMethod(primitiveType); + if (seenFieldNames.add(fieldName)) + { + groupFieldNames.add(fieldName); - sb.append(" const ").append(fieldName).append(" = view.") - .append(dataViewMethod).append("(pos"); + final PrimitiveType primitiveType = typeToken.encoding().primitiveType(); + final String dataViewMethod = dataViewMethod(primitiveType); - if (needsEndianness(primitiveType)) - { - sb.append(", this.littleEndian"); - } + sb.append(" const ").append(fieldName).append(" = view.") + .append(dataViewMethod).append("(pos"); - sb.append(");\n"); - sb.append(" pos += ").append(typeToken.encodedLength()).append(";\n\n"); + if (needsEndianness(primitiveType)) + { + sb.append(", this.littleEndian"); + } - groupFieldValues.add(fieldName); + sb.append(");\n"); + sb.append(" pos += ").append(typeToken.encodedLength()).append(";\n\n"); + + groupFieldValues.add(fieldName); + } + else + { + // Skip duplicate field - just advance position + sb.append(" pos += ").append(typeToken.encodedLength()).append(";\n\n"); + } }); // Skip to next block for forward compatibility From e1ae4ca981f8bc9e45dcea62ccaf090a1cd7d6a6 Mon Sep 17 00:00:00 2001 From: Pablo Date: Sat, 24 Jan 2026 14:49:13 +0100 Subject: [PATCH 08/11] add php and pyhthon --- .../sbe/generation/php/PHPGenerator.java | 384 +++++++++++++++-- .../generation/python/PythonGenerator.java | 385 +++++++++++++++++- 2 files changed, 723 insertions(+), 46 deletions(-) diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPGenerator.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPGenerator.java index ec800471fa..ab6af75411 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPGenerator.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/php/PHPGenerator.java @@ -299,6 +299,57 @@ private void generateCompositeEncodeDecode( sb.append("}\n"); } + private void generateGroupClasses( + final StringBuilder sb, + final List groups) + { + for (int i = 0; i < groups.size();) + { + final Token groupToken = groups.get(i); + if (groupToken.signal() == Signal.BEGIN_GROUP) + { + final String groupName = formatClassName(groupToken.name()); + final List groupTokens = new ArrayList<>(); + + final int endIndex = i + groupToken.componentTokenCount(); + for (int j = i; j < endIndex; j++) + { + groupTokens.add(groups.get(j)); + } + + final List groupBody = groupTokens.subList(1, groupTokens.size() - 1); + + sb.append(String.format("class %s\n{\n", groupName)); + + final java.util.Set seenFields = new java.util.HashSet<>(); + for (int j = 0; j < groupBody.size(); j++) + { + final Token token = groupBody.get(j); + if (token.signal() == Signal.BEGIN_FIELD && j + 1 < groupBody.size()) + { + final Token encodingToken = groupBody.get(j + 1); + if (encodingToken.signal() == Signal.ENCODING) + { + final String propName = formatPropertyName(token.name()); + if (seenFields.add(propName)) + { + sb.append(String.format(" public int|float|null $%s = null;\n", propName)); + } + } + } + } + + sb.append("}\n\n"); + + i = endIndex; + } + else + { + i++; + } + } + } + private void generateMessageClass( final StringBuilder sb, final String className, @@ -306,16 +357,25 @@ private void generateMessageClass( { final Token msgToken = tokens.get(0); + final List messageBody = tokens.subList(1, tokens.size() - 1); + final List fields = new ArrayList<>(); + int i = collectFields(messageBody, 0, fields); + + final List groups = new ArrayList<>(); + i = collectGroups(messageBody, i, groups); + + final List varData = new ArrayList<>(); + collectVarData(messageBody, i, varData); + + // Generate group classes first + generateGroupClasses(sb, groups); + sb.append(String.format("class %s\n{\n", className)); sb.append(String.format(" public const TEMPLATE_ID = %d;\n", msgToken.id())); sb.append(String.format(" public const SCHEMA_ID = %d;\n", ir.id())); sb.append(String.format(" public const SCHEMA_VERSION = %d;\n", ir.version())); sb.append(String.format(" public const BLOCK_LENGTH = %d;\n\n", msgToken.encodedLength())); - final List messageBody = tokens.subList(1, tokens.size() - 1); - final List fields = new ArrayList<>(); - int i = collectFields(messageBody, 0, fields); - // Declare properties for (final Token fieldToken : fields) { @@ -326,9 +386,6 @@ private void generateMessageClass( } } - final List groups = new ArrayList<>(); - i = collectGroups(messageBody, i, groups); - for (int j = 0; j < groups.size();) { final Token groupToken = groups.get(j); @@ -344,9 +401,6 @@ private void generateMessageClass( } } - final List varData = new ArrayList<>(); - collectVarData(messageBody, i, varData); - for (int j = 0; j < varData.size();) { final Token varDataToken = varData.get(j); @@ -367,6 +421,173 @@ private void generateMessageClass( generateMessageEncodeDecode(sb, className, tokens, fields, groups, varData); } + private void generateGroupDecoderMethods( + final StringBuilder sb, + final List groups) + { + for (int i = 0; i < groups.size();) + { + final Token groupToken = groups.get(i); + if (groupToken.signal() == Signal.BEGIN_GROUP) + { + final String groupName = formatClassName(groupToken.name()); + final List groupTokens = new ArrayList<>(); + + final int endIndex = i + groupToken.componentTokenCount(); + for (int j = i; j < endIndex; j++) + { + groupTokens.add(groups.get(j)); + } + + final List groupBody = groupTokens.subList(1, groupTokens.size() - 1); + + final Token blockLengthToken = uk.co.real_logic.sbe.generation.Generators.findFirst( + "blockLength", groupTokens, 0); + final Token numInGroupToken = uk.co.real_logic.sbe.generation.Generators.findFirst( + "numInGroup", groupTokens, 0); + + final String blockLengthFormat = phpPackFormat(blockLengthToken.encoding().primitiveType()); + final String numInGroupFormat = phpPackFormat(numInGroupToken.encoding().primitiveType()); + final int blockLengthSize = primitiveTypeSize(blockLengthToken.encoding().primitiveType()); + final int numInGroupSize = primitiveTypeSize(numInGroupToken.encoding().primitiveType()); + + sb.append(String.format( + " private function decode%sGroup(string $data, int &$offset): array\n", + groupName)); + sb.append(" {\n"); + + sb.append(String.format( + " $blockLength = unpack('%s', substr($data, $offset, %d))[1];\n", + blockLengthFormat, blockLengthSize)); + sb.append(String.format(" $offset += %d;\n", blockLengthSize)); + sb.append(String.format( + " $numInGroup = unpack('%s', substr($data, $offset, %d))[1];\n", + numInGroupFormat, numInGroupSize)); + sb.append(String.format(" $offset += %d;\n\n", numInGroupSize)); + + sb.append(" $items = [];\n"); + sb.append(" for ($i = 0; $i < $numInGroup; $i++) {\n"); + sb.append(" $itemStart = $offset;\n"); + sb.append(String.format(" $item = new %s();\n\n", groupName)); + + final java.util.Set seenFields = new java.util.HashSet<>(); + for (int j = 0; j < groupBody.size(); j++) + { + final Token fieldToken = groupBody.get(j); + if (fieldToken.signal() == Signal.BEGIN_FIELD && j + 1 < groupBody.size()) + { + final Token encodingToken = groupBody.get(j + 1); + if (encodingToken.signal() == Signal.ENCODING) + { + final String propName = formatPropertyName(fieldToken.name()); + final String packFormat = phpPackFormat(encodingToken.encoding().primitiveType()); + final int size = primitiveTypeSize(encodingToken.encoding().primitiveType()); + + if (seenFields.add(propName)) + { + sb.append(String.format( + " $item->%s = unpack('%s', substr($data, $offset, %d))[1];\n", + propName, packFormat, size)); + sb.append(String.format(" $offset += %d;\n", size)); + } + else + { + sb.append(String.format(" $offset += %d; // Skip duplicate field\n", size)); + } + } + j++; + } + } + + sb.append("\n // Skip to next block for forward compatibility\n"); + sb.append(" $offset = $itemStart + $blockLength;\n"); + sb.append(" $items[] = $item;\n"); + sb.append(" }\n\n"); + + sb.append(" return $items;\n"); + sb.append(" }\n\n"); + + i = endIndex; + } + else + { + i++; + } + } + } + + private void generateVarDataDecoderMethods(final StringBuilder sb, final List varData) + { + boolean needsVarData = false; + boolean needsUtf8 = false; + boolean needsAscii = false; + + for (int i = 0; i < varData.size();) + { + final Token varDataToken = varData.get(i); + if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) + { + final Encoding encoding = varDataToken.encoding(); + final String characterEncoding = encoding.characterEncoding(); + + if (null == characterEncoding) + { + needsVarData = true; + } + else if ("UTF-8".equals(characterEncoding)) + { + needsUtf8 = true; + } + else + { + needsAscii = true; + } + + i += varDataToken.componentTokenCount(); + } + else + { + i++; + } + } + + if (needsVarData) + { + sb.append(" private function decodeVarData(string $data, int &$offset): string\n"); + sb.append(" {\n"); + sb.append(" $length = unpack('V', substr($data, $offset, 4))[1];\n"); + sb.append(" $offset += 4;\n"); + sb.append(" $value = substr($data, $offset, $length);\n"); + sb.append(" $offset += $length;\n"); + sb.append(" return $value;\n"); + sb.append(" }\n\n"); + } + + if (needsUtf8) + { + sb.append(" private function decodeVarStringUtf8(string $data, int &$offset): string\n"); + sb.append(" {\n"); + sb.append(" $length = unpack('V', substr($data, $offset, 4))[1];\n"); + sb.append(" $offset += 4;\n"); + sb.append(" $value = substr($data, $offset, $length);\n"); + sb.append(" $offset += $length;\n"); + sb.append(" return $value;\n"); + sb.append(" }\n\n"); + } + + if (needsAscii) + { + sb.append(" private function decodeVarStringAscii(string $data, int &$offset): string\n"); + sb.append(" {\n"); + sb.append(" $length = unpack('V', substr($data, $offset, 4))[1];\n"); + sb.append(" $offset += 4;\n"); + sb.append(" $value = substr($data, $offset, $length);\n"); + sb.append(" $offset += $length;\n"); + sb.append(" return $value;\n"); + sb.append(" }\n\n"); + } + } + private void generateMessageEncodeDecode( final StringBuilder sb, final String className, @@ -375,7 +596,13 @@ private void generateMessageEncodeDecode( final List groups, final List varData) { - final String byteOrder = ir.byteOrder() == ByteOrder.LITTLE_ENDIAN ? "<" : ">"; + final Token msgToken = tokens.get(0); + + // Generate group decoder methods + generateGroupDecoderMethods(sb, groups); + + // Generate variable data decoder methods + generateVarDataDecoderMethods(sb, varData); // Encode method sb.append(" public function encode(): string\n"); @@ -425,7 +652,8 @@ private void generateMessageEncodeDecode( sb.append(" {\n"); sb.append(" $offset = 0;\n\n"); - // Decode fields + // Decode fields with duplicate detection + final java.util.Set seenFieldNames = new java.util.HashSet<>(); for (int i = 0; i < fields.size(); i++) { final Token fieldToken = fields.get(i); @@ -438,28 +666,136 @@ private void generateMessageEncodeDecode( final String packFormat = phpPackFormat(encodingToken.encoding().primitiveType()); final int size = primitiveTypeSize(encodingToken.encoding().primitiveType()); - if (encodingToken.arrayLength() > 1) + if (seenFieldNames.add(propertyName)) { - sb.append(String.format( - " $this->%s = [];\n" + - " for ($i = 0; $i < %d; $i++) {\n" + - " $this->%s[] = unpack('%s', substr($data, $offset, %d))[1];\n" + - " $offset += %d;\n" + - " }\n", - propertyName, encodingToken.arrayLength(), propertyName, packFormat, size, size)); + if (encodingToken.arrayLength() > 1) + { + sb.append(String.format( + " $this->%s = [];\n" + + " for ($i = 0; $i < %d; $i++) {\n" + + " $this->%s[] = unpack('%s', substr($data, $offset, %d))[1];\n" + + " $offset += %d;\n" + + " }\n", + propertyName, encodingToken.arrayLength(), propertyName, packFormat, size, size)); + } + else + { + sb.append(String.format( + " $this->%s = unpack('%s', substr($data, $offset, %d))[1];\n", + propertyName, packFormat, size)); + sb.append(String.format(" $offset += %d;\n", size)); + } } else { - sb.append(String.format( - " $this->%s = unpack('%s', substr($data, $offset, %d))[1];\n" + - " $offset += %d;\n", - propertyName, packFormat, size, size)); + if (encodingToken.arrayLength() > 1) + { + sb.append(String.format( + " $offset += %d; // Skip duplicate field array\n", + size * encodingToken.arrayLength())); + } + else + { + sb.append(String.format(" $offset += %d; // Skip duplicate field\n", size)); + } } } i++; // Skip encoding token } } + // Skip to block end for forward compatibility + sb.append("\n // Skip to end of block for forward compatibility\n"); + sb.append(String.format(" $offset = %d;\n\n", msgToken.encodedLength())); + + // Decode groups + for (int j = 0; j < groups.size();) + { + final Token groupToken = groups.get(j); + if (groupToken.signal() == Signal.BEGIN_GROUP) + { + final String groupName = formatClassName(groupToken.name()); + final String propertyName = formatPropertyName(groupToken.name()); + + if (seenFieldNames.add(propertyName)) + { + sb.append(String.format(" $this->%s = $this->decode%sGroup($data, $offset);\n", + propertyName, groupName)); + } + else + { + sb.append(String.format(" $this->decode%sGroup($data, $offset); " + + "// Skip duplicate group\n", groupName)); + } + + j += groupToken.componentTokenCount(); + } + else + { + j++; + } + } + + // Decode variable-length data + if (!varData.isEmpty()) + { + sb.append("\n"); + } + + for (int j = 0; j < varData.size();) + { + final Token varDataToken = varData.get(j); + if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) + { + final String propertyName = formatPropertyName(varDataToken.name()); + final Encoding encoding = varDataToken.encoding(); + final String characterEncoding = encoding.characterEncoding(); + + if (seenFieldNames.add(propertyName)) + { + if (null == characterEncoding) + { + sb.append(String.format(" $this->%s = $this->decodeVarData($data, $offset);\n", + propertyName)); + } + else if ("UTF-8".equals(characterEncoding)) + { + sb.append(String.format(" $this->%s = $this->decodeVarStringUtf8($data, $offset);\n", + propertyName)); + } + else + { + sb.append(String.format(" $this->%s = $this->decodeVarStringAscii($data, $offset);\n", + propertyName)); + } + } + else + { + if (null == characterEncoding) + { + sb.append(String.format(" $this->decodeVarData($data, $offset); " + + "// Skip duplicate vardata\n")); + } + else if ("UTF-8".equals(characterEncoding)) + { + sb.append(String.format(" $this->decodeVarStringUtf8($data, $offset); " + + "// Skip duplicate vardata\n")); + } + else + { + sb.append(String.format(" $this->decodeVarStringAscii($data, $offset); " + + "// Skip duplicate vardata\n")); + } + } + + j += varDataToken.componentTokenCount(); + } + else + { + j++; + } + } + sb.append(" }\n"); sb.append("}\n"); } diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonGenerator.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonGenerator.java index 43c49e7d52..cce8dbab28 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonGenerator.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/python/PythonGenerator.java @@ -92,7 +92,7 @@ private void generateFileHeader(final StringBuilder sb) { sb.append("\"\"\"Generated SBE (Simple Binary Encoding) message codec.\"\"\"\n\n"); sb.append("import struct\n"); - sb.append("from typing import List, Optional, Tuple\n"); + sb.append("from typing import List, Optional, Tuple, Set\n"); sb.append("from io import BytesIO\n\n"); } @@ -299,6 +299,59 @@ private void generateCompositeEncodeDecode( sb.append(String.format(" return %d\n", tokens.get(0).encodedLength())); } + private void generateGroupClasses( + final StringBuilder sb, + final List groups) + { + for (int i = 0; i < groups.size();) + { + final Token groupToken = groups.get(i); + if (groupToken.signal() == Signal.BEGIN_GROUP) + { + final String groupName = formatClassName(groupToken.name()); + final List groupTokens = new ArrayList<>(); + + final int endIndex = i + groupToken.componentTokenCount(); + for (int j = i; j < endIndex; j++) + { + groupTokens.add(groups.get(j)); + } + + final List groupBody = groupTokens.subList(1, groupTokens.size() - 1); + + sb.append(String.format("class %s:\n", groupName)); + sb.append(" \"\"\"Repeating group item.\"\"\"\n\n"); + sb.append(" def __init__(self):\n"); + + final java.util.Set seenFields = new java.util.HashSet<>(); + for (int j = 0; j < groupBody.size(); j++) + { + final Token token = groupBody.get(j); + if (token.signal() == Signal.BEGIN_FIELD && j + 1 < groupBody.size()) + { + final Token encodingToken = groupBody.get(j + 1); + if (encodingToken.signal() == Signal.ENCODING) + { + final String propName = formatPropertyName(token.name()); + if (seenFields.add(propName)) + { + sb.append(String.format(" self.%s = None\n", propName)); + } + } + } + } + + sb.append("\n"); + + i = endIndex; + } + else + { + i++; + } + } + } + private void generateMessageClass( final StringBuilder sb, final String className, @@ -306,6 +359,19 @@ private void generateMessageClass( { final Token msgToken = tokens.get(0); + final List messageBody = tokens.subList(1, tokens.size() - 1); + final List fields = new ArrayList<>(); + int i = collectFields(messageBody, 0, fields); + + final List groups = new ArrayList<>(); + i = collectGroups(messageBody, i, groups); + + final List varData = new ArrayList<>(); + collectVarData(messageBody, i, varData); + + // Generate group classes first + generateGroupClasses(sb, groups); + sb.append(String.format("class %s:\n", className)); sb.append(String.format(" \"\"\"SBE message: %s.\"\"\"\n\n", msgToken.name())); sb.append(String.format(" TEMPLATE_ID = %d\n", msgToken.id())); @@ -316,10 +382,6 @@ private void generateMessageClass( // Constructor sb.append(" def __init__(self):\n"); - final List messageBody = tokens.subList(1, tokens.size() - 1); - final List fields = new ArrayList<>(); - int i = collectFields(messageBody, 0, fields); - // Initialize fields for (final Token fieldToken : fields) { @@ -330,9 +392,6 @@ private void generateMessageClass( } } - final List groups = new ArrayList<>(); - i = collectGroups(messageBody, i, groups); - for (int j = 0; j < groups.size();) { final Token groupToken = groups.get(j); @@ -348,9 +407,6 @@ private void generateMessageClass( } } - final List varData = new ArrayList<>(); - collectVarData(messageBody, i, varData); - for (int j = 0; j < varData.size();) { final Token varDataToken = varData.get(j); @@ -371,6 +427,173 @@ private void generateMessageClass( generateMessageEncodeDecode(sb, className, tokens, fields, groups, varData); } + private void generateGroupDecoderMethods( + final StringBuilder sb, + final List groups, + final String byteOrder) + { + for (int i = 0; i < groups.size();) + { + final Token groupToken = groups.get(i); + if (groupToken.signal() == Signal.BEGIN_GROUP) + { + final String groupName = formatClassName(groupToken.name()); + final List groupTokens = new ArrayList<>(); + + final int endIndex = i + groupToken.componentTokenCount(); + for (int j = i; j < endIndex; j++) + { + groupTokens.add(groups.get(j)); + } + + final List groupBody = groupTokens.subList(1, groupTokens.size() - 1); + + final Token blockLengthToken = uk.co.real_logic.sbe.generation.Generators.findFirst( + "blockLength", groupTokens, 0); + final Token numInGroupToken = uk.co.real_logic.sbe.generation.Generators.findFirst( + "numInGroup", groupTokens, 0); + + final String blockLengthFormat = pythonStructFormat(blockLengthToken.encoding().primitiveType()); + final String numInGroupFormat = pythonStructFormat(numInGroupToken.encoding().primitiveType()); + final int blockLengthSize = primitiveTypeSize(blockLengthToken.encoding().primitiveType()); + final int numInGroupSize = primitiveTypeSize(numInGroupToken.encoding().primitiveType()); + + sb.append(String.format( + " def _decode_%s_group(self, data: bytes, offset: int) -> Tuple[List[%s], int]:\n", + formatPropertyName(groupToken.name()), groupName)); + sb.append(" \"\"\"Decode repeating group.\"\"\"\n"); + sb.append(" pos = offset\n\n"); + + sb.append(String.format( + " block_length = struct.unpack_from('%s%s', data, pos)[0]\n", + byteOrder, blockLengthFormat)); + sb.append(String.format(" pos += %d\n", blockLengthSize)); + sb.append(String.format( + " num_in_group = struct.unpack_from('%s%s', data, pos)[0]\n", + byteOrder, numInGroupFormat)); + sb.append(String.format(" pos += %d\n\n", numInGroupSize)); + + sb.append(" items = []\n"); + sb.append(" for _ in range(num_in_group):\n"); + sb.append(" item_start = pos\n"); + sb.append(String.format(" item = %s()\n\n", groupName)); + + final java.util.Set seenFields = new java.util.HashSet<>(); + for (int j = 0; j < groupBody.size(); j++) + { + final Token fieldToken = groupBody.get(j); + if (fieldToken.signal() == Signal.BEGIN_FIELD && j + 1 < groupBody.size()) + { + final Token encodingToken = groupBody.get(j + 1); + if (encodingToken.signal() == Signal.ENCODING) + { + final String propName = formatPropertyName(fieldToken.name()); + final String structFormat = pythonStructFormat(encodingToken.encoding().primitiveType()); + final int size = primitiveTypeSize(encodingToken.encoding().primitiveType()); + + if (seenFields.add(propName)) + { + sb.append(String.format( + " item.%s = struct.unpack_from('%s%s', data, pos)[0]\n", + propName, byteOrder, structFormat)); + sb.append(String.format(" pos += %d\n", size)); + } + else + { + sb.append(String.format(" pos += %d # Skip duplicate field\n", size)); + } + } + j++; + } + } + + sb.append("\n # Skip to next block for forward compatibility\n"); + sb.append(" pos = item_start + block_length\n"); + sb.append(" items.append(item)\n\n"); + + sb.append(" return (items, pos)\n\n"); + + i = endIndex; + } + else + { + i++; + } + } + } + + private void generateVarDataDecoderMethods(final StringBuilder sb, final List varData) + { + boolean needsVarData = false; + boolean needsUtf8 = false; + boolean needsAscii = false; + + for (int i = 0; i < varData.size();) + { + final Token varDataToken = varData.get(i); + if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) + { + final Encoding encoding = varDataToken.encoding(); + final String characterEncoding = encoding.characterEncoding(); + + if (null == characterEncoding) + { + needsVarData = true; + } + else if ("UTF-8".equals(characterEncoding)) + { + needsUtf8 = true; + } + else + { + needsAscii = true; + } + + i += varDataToken.componentTokenCount(); + } + else + { + i++; + } + } + + if (needsVarData) + { + sb.append(" def _decode_var_data(self, data: bytes, offset: int) -> Tuple[bytes, int]:\n"); + sb.append(" \"\"\"Decode variable-length binary data.\"\"\"\n"); + sb.append(" pos = offset\n"); + sb.append(" length = struct.unpack_from(' Tuple[str, int]:\n"); + sb.append(" \"\"\"Decode variable-length UTF-8 string.\"\"\"\n"); + sb.append(" pos = offset\n"); + sb.append(" length = struct.unpack_from(' Tuple[str, int]:\n"); + sb.append(" \"\"\"Decode variable-length ASCII string.\"\"\"\n"); + sb.append(" pos = offset\n"); + sb.append(" length = struct.unpack_from(' varData) { final String byteOrder = ir.byteOrder() == ByteOrder.LITTLE_ENDIAN ? "<" : ">"; + final Token msgToken = tokens.get(0); + + // Generate group decoder methods + generateGroupDecoderMethods(sb, groups, byteOrder); + + // Generate variable data decoder methods + generateVarDataDecoderMethods(sb, varData); // Encode method sb.append(" def encode(self) -> bytes:\n"); @@ -423,9 +653,10 @@ private void generateMessageEncodeDecode( // Decode method sb.append(" def decode(self, data: bytes) -> None:\n"); sb.append(" \"\"\"Decode the message from bytes.\"\"\"\n"); - sb.append(" buffer = BytesIO(data)\n\n"); + sb.append(" pos = 0\n\n"); - // Decode fields + // Decode fields with duplicate detection + final java.util.Set seenFieldNames = new java.util.HashSet<>(); for (int i = 0; i < fields.size(); i++) { final Token fieldToken = fields.get(i); @@ -438,23 +669,133 @@ private void generateMessageEncodeDecode( final String structFormat = pythonStructFormat(encodingToken.encoding().primitiveType()); final int size = primitiveTypeSize(encodingToken.encoding().primitiveType()); - if (encodingToken.arrayLength() > 1) + if (seenFieldNames.add(propertyName)) { - sb.append(String.format( - " self.%s = []\n" + - " for _ in range(%d):\n" + - " self.%s.append(struct.unpack('%s%s', buffer.read(%d))[0])\n", - propertyName, encodingToken.arrayLength(), propertyName, byteOrder, structFormat, size)); + if (encodingToken.arrayLength() > 1) + { + sb.append(String.format( + " self.%s = []\n" + + " for _ in range(%d):\n" + + " self.%s.append(struct.unpack_from('%s%s', data, pos)[0])\n" + + " pos += %d\n", + propertyName, encodingToken.arrayLength(), propertyName, byteOrder, + structFormat, size)); + } + else + { + sb.append(String.format( + " self.%s = struct.unpack_from('%s%s', data, pos)[0]\n", + propertyName, byteOrder, structFormat)); + sb.append(String.format(" pos += %d\n", size)); + } } else { - sb.append(String.format( - " self.%s = struct.unpack('%s%s', buffer.read(%d))[0]\n", - propertyName, byteOrder, structFormat, size)); + if (encodingToken.arrayLength() > 1) + { + sb.append(String.format( + " pos += %d # Skip duplicate field array\n", + size * encodingToken.arrayLength())); + } + else + { + sb.append(String.format(" pos += %d # Skip duplicate field\n", size)); + } } } i++; // Skip encoding token } } + + // Skip to block end for forward compatibility + sb.append("\n # Skip to end of block for forward compatibility\n"); + sb.append(String.format(" pos = %d\n\n", msgToken.encodedLength())); + + // Decode groups + for (int j = 0; j < groups.size();) + { + final Token groupToken = groups.get(j); + if (groupToken.signal() == Signal.BEGIN_GROUP) + { + final String propertyName = formatPropertyName(groupToken.name()); + + if (seenFieldNames.add(propertyName)) + { + sb.append(String.format(" self.%s, pos = self._decode_%s_group(data, pos)\n", + propertyName, propertyName)); + } + else + { + sb.append(String.format(" _, pos = self._decode_%s_group(data, pos) " + + "# Skip duplicate group\n", propertyName)); + } + + j += groupToken.componentTokenCount(); + } + else + { + j++; + } + } + + // Decode variable-length data + if (!varData.isEmpty()) + { + sb.append("\n"); + } + + for (int j = 0; j < varData.size();) + { + final Token varDataToken = varData.get(j); + if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) + { + final String propertyName = formatPropertyName(varDataToken.name()); + final Encoding encoding = varDataToken.encoding(); + final String characterEncoding = encoding.characterEncoding(); + + if (seenFieldNames.add(propertyName)) + { + if (null == characterEncoding) + { + sb.append(String.format(" self.%s, pos = self._decode_var_data(data, pos)\n", + propertyName)); + } + else if ("UTF-8".equals(characterEncoding)) + { + sb.append(String.format(" self.%s, pos = self._decode_var_string_utf8(data, pos)\n", + propertyName)); + } + else + { + sb.append(String.format(" self.%s, pos = self._decode_var_string_ascii(data, pos)\n", + propertyName)); + } + } + else + { + if (null == characterEncoding) + { + sb.append(String.format(" _, pos = self._decode_var_data(data, pos) " + + "# Skip duplicate vardata\n")); + } + else if ("UTF-8".equals(characterEncoding)) + { + sb.append(String.format(" _, pos = self._decode_var_string_utf8(data, pos) " + + "# Skip duplicate vardata\n")); + } + else + { + sb.append(String.format(" _, pos = self._decode_var_string_ascii(data, pos) " + + "# Skip duplicate vardata\n")); + } + } + + j += varDataToken.componentTokenCount(); + } + else + { + j++; + } + } } } From f5143f3a78362804df095ae0c3641ead8e60bc97 Mon Sep 17 00:00:00 2001 From: Pablo Date: Sat, 7 Mar 2026 10:27:42 -0500 Subject: [PATCH 09/11] Fix TypeScript composite decoder: use Signal.ENCODING instead of BEGIN_FIELD The composite decoder used Generators.forEachField() which only matches Signal.BEGIN_FIELD tokens, but composite type inner tokens use Signal.ENCODING. This produced empty interfaces and wrong ENCODED_LENGTH (e.g., MessageHeader had ENCODED_LENGTH=2 instead of 8), causing all subsequent field reads to be offset by 6 bytes. Rewrite generateCompositeDecoder() to iterate tokens checking for Signal.ENCODING, matching the pattern already used by the Python and PHP generators. Pass encodedLength as a parameter from the composite token. Regenerated all TypeScript output from the Binance schema. --- .../spot_sbe/AccountAllocationsResponse.ts | 163 +++++++ .../spot_sbe/AccountCommissionResponse.ts | 155 +++++++ .../spot_sbe/AccountOrderRateLimitResponse.ts | 103 +++++ .../AccountPreventedMatchesResponse.ts | 133 ++++++ .../spot_sbe/AccountResponse.ts | 228 +++++++++ .../spot_sbe/AccountTradesResponse.ts | 148 ++++++ .../spot_sbe/AccountType.ts | 11 + .../spot_sbe/AggTradesResponse.ts | 128 ++++++ .../spot_sbe/AllocationType.ts | 11 + .../AllowedSelfTradePreventionModes.ts | 35 ++ .../spot_sbe/AveragePriceResponse.ts | 68 +++ .../spot_sbe/BalanceUpdateEvent.ts | 90 ++++ .../spot_sbe/BookTickerResponse.ts | 108 +++++ .../spot_sbe/BookTickerSymbolResponse.ts | 95 ++++ .../generated-typescript/spot_sbe/BoolEnum.ts | 10 + .../spot_sbe/CancelOpenOrdersResponse.ts | 78 ++++ .../spot_sbe/CancelOrderListResponse.ts | 305 ++++++++++++ .../spot_sbe/CancelOrderResponse.ts | 220 +++++++++ .../spot_sbe/CancelReplaceOrderResponse.ts | 80 ++++ .../spot_sbe/CancelReplaceStatus.ts | 12 + .../spot_sbe/ContingencyType.ts | 11 + .../spot_sbe/DepthResponse.ts | 143 ++++++ .../spot_sbe/ErrorResponse.ts | 85 ++++ .../spot_sbe/EventStreamTerminatedEvent.ts | 58 +++ .../spot_sbe/ExchangeInfoResponse.ts | 278 +++++++++++ .../ExchangeMaxNumAlgoOrdersFilter.ts | 58 +++ .../ExchangeMaxNumIcebergOrdersFilter.ts | 58 +++ .../ExchangeMaxNumOrderListsFilter.ts | 58 +++ .../spot_sbe/ExchangeMaxNumOrdersFilter.ts | 58 +++ .../spot_sbe/ExecutionReportEvent.ts | 355 ++++++++++++++ .../spot_sbe/ExecutionType.ts | 17 + .../spot_sbe/ExternalLockUpdateEvent.ts | 90 ++++ .../spot_sbe/FilterType.ts | 30 ++ .../generated-typescript/spot_sbe/Floor.ts | 12 + .../spot_sbe/GroupSize16Encoding.ts | 33 ++ .../spot_sbe/GroupSizeEncoding.ts | 33 ++ .../spot_sbe/IcebergPartsFilter.ts | 58 +++ .../spot_sbe/KlinesResponse.ts | 143 ++++++ .../spot_sbe/ListOrderStatus.ts | 13 + .../spot_sbe/ListStatusEvent.ts | 145 ++++++ .../spot_sbe/ListStatusType.ts | 13 + .../spot_sbe/LotSizeFilter.ts | 73 +++ .../spot_sbe/MarketLotSizeFilter.ts | 73 +++ .../spot_sbe/MatchType.ts | 11 + .../spot_sbe/MaxAssetFilter.ts | 80 ++++ .../spot_sbe/MaxNumAlgoOrdersFilter.ts | 58 +++ .../spot_sbe/MaxNumIcebergOrdersFilter.ts | 58 +++ .../spot_sbe/MaxNumOrderAmendsFilter.ts | 58 +++ .../spot_sbe/MaxNumOrderListsFilter.ts | 58 +++ .../spot_sbe/MaxNumOrdersFilter.ts | 58 +++ .../spot_sbe/MaxPositionFilter.ts | 63 +++ .../spot_sbe/MessageData.ts | 33 ++ .../spot_sbe/MessageData16.ts | 33 ++ .../spot_sbe/MessageData8.ts | 33 ++ .../spot_sbe/MessageHeader.ts | 43 ++ .../spot_sbe/MinNotionalFilter.ts | 73 +++ .../spot_sbe/MyFiltersResponse.ts | 138 ++++++ .../spot_sbe/NewOrderAckResponse.ts | 85 ++++ .../spot_sbe/NewOrderFullResponse.ts | 345 ++++++++++++++ .../spot_sbe/NewOrderListAckResponse.ts | 175 +++++++ .../spot_sbe/NewOrderListFullResponse.ts | 369 +++++++++++++++ .../spot_sbe/NewOrderListResultResponse.ts | 315 +++++++++++++ .../spot_sbe/NewOrderResultResponse.ts | 225 +++++++++ .../spot_sbe/NonRepresentableMessage.ts | 48 ++ .../spot_sbe/NotionalFilter.ts | 83 ++++ .../spot_sbe/OptionalMessageData.ts | 33 ++ .../spot_sbe/OptionalMessageData16.ts | 33 ++ .../spot_sbe/OptionalVarString.ts | 33 ++ .../spot_sbe/OptionalVarString8.ts | 33 ++ .../OrderAmendKeepPriorityResponse.ts | 435 ++++++++++++++++++ .../spot_sbe/OrderAmendmentsResponse.ts | 108 +++++ .../spot_sbe/OrderCapacity.ts | 11 + .../spot_sbe/OrderListResponse.ts | 130 ++++++ .../spot_sbe/OrderListsResponse.ts | 108 +++++ .../spot_sbe/OrderResponse.ts | 235 ++++++++++ .../spot_sbe/OrderSide.ts | 11 + .../spot_sbe/OrderStatus.ts | 19 + .../spot_sbe/OrderTestResponse.ts | 48 ++ .../OrderTestWithCommissionsResponse.ts | 120 +++++ .../spot_sbe/OrderType.ts | 16 + .../spot_sbe/OrderTypes.ts | 37 ++ .../spot_sbe/OrdersResponse.ts | 243 ++++++++++ .../spot_sbe/OutboundAccountPositionEvent.ts | 108 +++++ .../spot_sbe/PegOffsetType.ts | 10 + .../spot_sbe/PegPriceType.ts | 11 + .../spot_sbe/PercentPriceBySideFilter.ts | 83 ++++ .../spot_sbe/PercentPriceFilter.ts | 73 +++ .../spot_sbe/PingResponse.ts | 48 ++ .../spot_sbe/PriceFilter.ts | 73 +++ .../spot_sbe/PriceTickerResponse.ts | 88 ++++ .../spot_sbe/PriceTickerSymbolResponse.ts | 75 +++ .../spot_sbe/RateLimitInterval.ts | 13 + .../spot_sbe/RateLimitType.ts | 13 + .../spot_sbe/SelfTradePreventionMode.ts | 15 + .../spot_sbe/ServerTimeResponse.ts | 53 +++ .../spot_sbe/SymbolStatus.ts | 13 + .../spot_sbe/TPlusFilterLockEvent.ts | 125 +++++ .../spot_sbe/TPlusSellFilter.ts | 58 +++ .../spot_sbe/Ticker24hFullResponse.ts | 188 ++++++++ .../spot_sbe/Ticker24hMiniResponse.ts | 143 ++++++ .../spot_sbe/Ticker24hSymbolFullResponse.ts | 175 +++++++ .../spot_sbe/Ticker24hSymbolMiniResponse.ts | 130 ++++++ .../spot_sbe/TickerFullResponse.ts | 158 +++++++ .../spot_sbe/TickerMiniResponse.ts | 143 ++++++ .../spot_sbe/TickerSymbolFullResponse.ts | 145 ++++++ .../spot_sbe/TickerSymbolMiniResponse.ts | 130 ++++++ .../spot_sbe/TimeInForce.ts | 12 + .../spot_sbe/TradesResponse.ts | 123 +++++ .../spot_sbe/TrailingDeltaFilter.ts | 73 +++ .../spot_sbe/UserDataStreamPingResponse.ts | 48 ++ .../spot_sbe/UserDataStreamStartResponse.ts | 65 +++ .../spot_sbe/UserDataStreamStopResponse.ts | 48 ++ ...rDataStreamSubscribeListenTokenResponse.ts | 58 +++ .../UserDataStreamSubscribeResponse.ts | 53 +++ .../UserDataStreamUnsubscribeResponse.ts | 48 ++ .../spot_sbe/VarString.ts | 33 ++ .../spot_sbe/VarString8.ts | 33 ++ .../spot_sbe/WebSocketResponse.ts | 135 ++++++ .../spot_sbe/WebSocketSessionLogonResponse.ts | 90 ++++ .../WebSocketSessionLogoutResponse.ts | 90 ++++ .../WebSocketSessionStatusResponse.ts | 90 ++++ .../WebSocketSessionSubscriptionsResponse.ts | 88 ++++ .../generated-typescript/spot_sbe/index.ts | 128 ++++++ .../typescript/TypeScriptGenerator.java | 103 +++-- 124 files changed, 11513 insertions(+), 47 deletions(-) create mode 100644 binance/generated-typescript/spot_sbe/AccountAllocationsResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/AccountCommissionResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/AccountOrderRateLimitResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/AccountPreventedMatchesResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/AccountResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/AccountTradesResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/AccountType.ts create mode 100644 binance/generated-typescript/spot_sbe/AggTradesResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/AllocationType.ts create mode 100644 binance/generated-typescript/spot_sbe/AllowedSelfTradePreventionModes.ts create mode 100644 binance/generated-typescript/spot_sbe/AveragePriceResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/BalanceUpdateEvent.ts create mode 100644 binance/generated-typescript/spot_sbe/BookTickerResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/BookTickerSymbolResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/BoolEnum.ts create mode 100644 binance/generated-typescript/spot_sbe/CancelOpenOrdersResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/CancelOrderListResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/CancelOrderResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/CancelReplaceOrderResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/CancelReplaceStatus.ts create mode 100644 binance/generated-typescript/spot_sbe/ContingencyType.ts create mode 100644 binance/generated-typescript/spot_sbe/DepthResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/ErrorResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/EventStreamTerminatedEvent.ts create mode 100644 binance/generated-typescript/spot_sbe/ExchangeInfoResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/ExchangeMaxNumAlgoOrdersFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/ExchangeMaxNumIcebergOrdersFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/ExchangeMaxNumOrderListsFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/ExchangeMaxNumOrdersFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/ExecutionReportEvent.ts create mode 100644 binance/generated-typescript/spot_sbe/ExecutionType.ts create mode 100644 binance/generated-typescript/spot_sbe/ExternalLockUpdateEvent.ts create mode 100644 binance/generated-typescript/spot_sbe/FilterType.ts create mode 100644 binance/generated-typescript/spot_sbe/Floor.ts create mode 100644 binance/generated-typescript/spot_sbe/GroupSize16Encoding.ts create mode 100644 binance/generated-typescript/spot_sbe/GroupSizeEncoding.ts create mode 100644 binance/generated-typescript/spot_sbe/IcebergPartsFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/KlinesResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/ListOrderStatus.ts create mode 100644 binance/generated-typescript/spot_sbe/ListStatusEvent.ts create mode 100644 binance/generated-typescript/spot_sbe/ListStatusType.ts create mode 100644 binance/generated-typescript/spot_sbe/LotSizeFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/MarketLotSizeFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/MatchType.ts create mode 100644 binance/generated-typescript/spot_sbe/MaxAssetFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/MaxNumAlgoOrdersFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/MaxNumIcebergOrdersFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/MaxNumOrderAmendsFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/MaxNumOrderListsFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/MaxNumOrdersFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/MaxPositionFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/MessageData.ts create mode 100644 binance/generated-typescript/spot_sbe/MessageData16.ts create mode 100644 binance/generated-typescript/spot_sbe/MessageData8.ts create mode 100644 binance/generated-typescript/spot_sbe/MessageHeader.ts create mode 100644 binance/generated-typescript/spot_sbe/MinNotionalFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/MyFiltersResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/NewOrderAckResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/NewOrderFullResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/NewOrderListAckResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/NewOrderListFullResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/NewOrderListResultResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/NewOrderResultResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/NonRepresentableMessage.ts create mode 100644 binance/generated-typescript/spot_sbe/NotionalFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/OptionalMessageData.ts create mode 100644 binance/generated-typescript/spot_sbe/OptionalMessageData16.ts create mode 100644 binance/generated-typescript/spot_sbe/OptionalVarString.ts create mode 100644 binance/generated-typescript/spot_sbe/OptionalVarString8.ts create mode 100644 binance/generated-typescript/spot_sbe/OrderAmendKeepPriorityResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/OrderAmendmentsResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/OrderCapacity.ts create mode 100644 binance/generated-typescript/spot_sbe/OrderListResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/OrderListsResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/OrderResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/OrderSide.ts create mode 100644 binance/generated-typescript/spot_sbe/OrderStatus.ts create mode 100644 binance/generated-typescript/spot_sbe/OrderTestResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/OrderTestWithCommissionsResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/OrderType.ts create mode 100644 binance/generated-typescript/spot_sbe/OrderTypes.ts create mode 100644 binance/generated-typescript/spot_sbe/OrdersResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/OutboundAccountPositionEvent.ts create mode 100644 binance/generated-typescript/spot_sbe/PegOffsetType.ts create mode 100644 binance/generated-typescript/spot_sbe/PegPriceType.ts create mode 100644 binance/generated-typescript/spot_sbe/PercentPriceBySideFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/PercentPriceFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/PingResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/PriceFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/PriceTickerResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/PriceTickerSymbolResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/RateLimitInterval.ts create mode 100644 binance/generated-typescript/spot_sbe/RateLimitType.ts create mode 100644 binance/generated-typescript/spot_sbe/SelfTradePreventionMode.ts create mode 100644 binance/generated-typescript/spot_sbe/ServerTimeResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/SymbolStatus.ts create mode 100644 binance/generated-typescript/spot_sbe/TPlusFilterLockEvent.ts create mode 100644 binance/generated-typescript/spot_sbe/TPlusSellFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/Ticker24hFullResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/Ticker24hMiniResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/Ticker24hSymbolFullResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/Ticker24hSymbolMiniResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/TickerFullResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/TickerMiniResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/TickerSymbolFullResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/TickerSymbolMiniResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/TimeInForce.ts create mode 100644 binance/generated-typescript/spot_sbe/TradesResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/TrailingDeltaFilter.ts create mode 100644 binance/generated-typescript/spot_sbe/UserDataStreamPingResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/UserDataStreamStartResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/UserDataStreamStopResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/UserDataStreamSubscribeListenTokenResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/UserDataStreamSubscribeResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/UserDataStreamUnsubscribeResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/VarString.ts create mode 100644 binance/generated-typescript/spot_sbe/VarString8.ts create mode 100644 binance/generated-typescript/spot_sbe/WebSocketResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/WebSocketSessionLogonResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/WebSocketSessionLogoutResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/WebSocketSessionStatusResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/WebSocketSessionSubscriptionsResponse.ts create mode 100644 binance/generated-typescript/spot_sbe/index.ts diff --git a/binance/generated-typescript/spot_sbe/AccountAllocationsResponse.ts b/binance/generated-typescript/spot_sbe/AccountAllocationsResponse.ts new file mode 100644 index 0000000000..d5fae5b13c --- /dev/null +++ b/binance/generated-typescript/spot_sbe/AccountAllocationsResponse.ts @@ -0,0 +1,163 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Allocations { + priceExponent: number; + qtyExponent: number; + commissionExponent: number; + allocationId: bigint; + allocationType: number; + orderId: bigint; + orderListId: bigint; + sourceTradeId: bigint; + sourceAllocationId: bigint; + price: bigint; + qty: bigint; + quoteQty: bigint; + commission: bigint; + time: bigint; + isBuyer: number; + isMaker: number; + isAllocator: number; +} + +export interface AccountAllocationsResponse { + allocations: Allocations[]; +} + +export class AccountAllocationsResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 404; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): AccountAllocationsResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + AccountAllocationsResponseDecoder.BLOCK_LENGTH; + + const allocations = this.decodeAllocationsGroup(view, pos); + pos = allocations.nextOffset; + + return { + allocations: allocations.items + }; + } + private decodeAllocationsGroup(view: DataView, offset: number): { items: Allocations[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Allocations[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const commissionExponent = view.getInt8(pos); + pos += 1; + + const allocationId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const allocationType = view.getUint8(pos); + pos += 1; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const sourceTradeId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const sourceAllocationId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const quoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const commission = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const time = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const isBuyer = view.getUint8(pos); + pos += 1; + + const isMaker = view.getUint8(pos); + pos += 1; + + const isAllocator = view.getUint8(pos); + pos += 1; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + priceExponent: priceExponent, + qtyExponent: qtyExponent, + commissionExponent: commissionExponent, + allocationId: allocationId, + allocationType: allocationType, + orderId: orderId, + orderListId: orderListId, + sourceTradeId: sourceTradeId, + sourceAllocationId: sourceAllocationId, + price: price, + qty: qty, + quoteQty: quoteQty, + commission: commission, + time: time, + isBuyer: isBuyer, + isMaker: isMaker, + isAllocator: isAllocator + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return AccountAllocationsResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return AccountAllocationsResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return AccountAllocationsResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return AccountAllocationsResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/AccountCommissionResponse.ts b/binance/generated-typescript/spot_sbe/AccountCommissionResponse.ts new file mode 100644 index 0000000000..dc52e1024d --- /dev/null +++ b/binance/generated-typescript/spot_sbe/AccountCommissionResponse.ts @@ -0,0 +1,155 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface AccountCommissionResponse { + commissionExponent: number; + discountExponent: number; + standardCommissionMaker: bigint; + standardCommissionTaker: bigint; + standardCommissionBuyer: bigint; + standardCommissionSeller: bigint; + taxCommissionMaker: bigint; + taxCommissionTaker: bigint; + taxCommissionBuyer: bigint; + taxCommissionSeller: bigint; + discountEnabledForAccount: number; + discountEnabledForSymbol: number; + discount: bigint; + specialCommissionMaker: bigint; + specialCommissionTaker: bigint; + specialCommissionBuyer: bigint; + specialCommissionSeller: bigint; + symbol: Uint8Array; + discountAsset: Uint8Array; +} + +export class AccountCommissionResponseDecoder { + private static readonly BLOCK_LENGTH = 108; + private static readonly TEMPLATE_ID = 405; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): AccountCommissionResponse { + const view = new DataView(buffer); + let pos = offset; + + const commissionExponent = view.getInt8(pos); + pos += 1; + + const discountExponent = view.getInt8(pos); + pos += 1; + + const standardCommissionMaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const standardCommissionTaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const standardCommissionBuyer = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const standardCommissionSeller = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const taxCommissionMaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const taxCommissionTaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const taxCommissionBuyer = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const taxCommissionSeller = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const discountEnabledForAccount = view.getUint8(pos); + pos += 1; + + const discountEnabledForSymbol = view.getUint8(pos); + pos += 1; + + const discount = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const specialCommissionMaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const specialCommissionTaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const specialCommissionBuyer = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const specialCommissionSeller = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + AccountCommissionResponseDecoder.BLOCK_LENGTH; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + const discountAsset = this.decodeVarData(view, pos); + pos = discountAsset.nextOffset; + + return { + commissionExponent: commissionExponent, + discountExponent: discountExponent, + standardCommissionMaker: standardCommissionMaker, + standardCommissionTaker: standardCommissionTaker, + standardCommissionBuyer: standardCommissionBuyer, + standardCommissionSeller: standardCommissionSeller, + taxCommissionMaker: taxCommissionMaker, + taxCommissionTaker: taxCommissionTaker, + taxCommissionBuyer: taxCommissionBuyer, + taxCommissionSeller: taxCommissionSeller, + discountEnabledForAccount: discountEnabledForAccount, + discountEnabledForSymbol: discountEnabledForSymbol, + discount: discount, + specialCommissionMaker: specialCommissionMaker, + specialCommissionTaker: specialCommissionTaker, + specialCommissionBuyer: specialCommissionBuyer, + specialCommissionSeller: specialCommissionSeller, + symbol: symbol.value, + discountAsset: discountAsset.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return AccountCommissionResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return AccountCommissionResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return AccountCommissionResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return AccountCommissionResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/AccountOrderRateLimitResponse.ts b/binance/generated-typescript/spot_sbe/AccountOrderRateLimitResponse.ts new file mode 100644 index 0000000000..e5fcbccfdd --- /dev/null +++ b/binance/generated-typescript/spot_sbe/AccountOrderRateLimitResponse.ts @@ -0,0 +1,103 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface RateLimits { + rateLimitType: number; + interval: number; + intervalNum: number; + rateLimit: bigint; + numOrders: bigint; +} + +export interface AccountOrderRateLimitResponse { + rateLimits: RateLimits[]; +} + +export class AccountOrderRateLimitResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 402; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): AccountOrderRateLimitResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + AccountOrderRateLimitResponseDecoder.BLOCK_LENGTH; + + const rateLimits = this.decodeRateLimitsGroup(view, pos); + pos = rateLimits.nextOffset; + + return { + rateLimits: rateLimits.items + }; + } + private decodeRateLimitsGroup(view: DataView, offset: number): { items: RateLimits[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: RateLimits[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const rateLimitType = view.getUint8(pos); + pos += 1; + + const interval = view.getUint8(pos); + pos += 1; + + const intervalNum = view.getUint8(pos); + pos += 1; + + const rateLimit = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const numOrders = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + rateLimitType: rateLimitType, + interval: interval, + intervalNum: intervalNum, + rateLimit: rateLimit, + numOrders: numOrders + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return AccountOrderRateLimitResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return AccountOrderRateLimitResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return AccountOrderRateLimitResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return AccountOrderRateLimitResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/AccountPreventedMatchesResponse.ts b/binance/generated-typescript/spot_sbe/AccountPreventedMatchesResponse.ts new file mode 100644 index 0000000000..c001c7bec4 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/AccountPreventedMatchesResponse.ts @@ -0,0 +1,133 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface PreventedMatches { + priceExponent: number; + qtyExponent: number; + preventedMatchId: bigint; + takerOrderId: bigint; + makerOrderId: bigint; + tradeGroupId: bigint; + selfTradePreventionMode: number; + price: bigint; + takerPreventedQuantity: bigint; + makerPreventedQuantity: bigint; + transactTime: bigint; +} + +export interface AccountPreventedMatchesResponse { + preventedMatches: PreventedMatches[]; +} + +export class AccountPreventedMatchesResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 403; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): AccountPreventedMatchesResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + AccountPreventedMatchesResponseDecoder.BLOCK_LENGTH; + + const preventedMatches = this.decodePreventedMatchesGroup(view, pos); + pos = preventedMatches.nextOffset; + + return { + preventedMatches: preventedMatches.items + }; + } + private decodePreventedMatchesGroup(view: DataView, offset: number): { items: PreventedMatches[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: PreventedMatches[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const preventedMatchId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const takerOrderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const makerOrderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const tradeGroupId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const selfTradePreventionMode = view.getUint8(pos); + pos += 1; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const takerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const makerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const transactTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + priceExponent: priceExponent, + qtyExponent: qtyExponent, + preventedMatchId: preventedMatchId, + takerOrderId: takerOrderId, + makerOrderId: makerOrderId, + tradeGroupId: tradeGroupId, + selfTradePreventionMode: selfTradePreventionMode, + price: price, + takerPreventedQuantity: takerPreventedQuantity, + makerPreventedQuantity: makerPreventedQuantity, + transactTime: transactTime + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return AccountPreventedMatchesResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return AccountPreventedMatchesResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return AccountPreventedMatchesResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return AccountPreventedMatchesResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/AccountResponse.ts b/binance/generated-typescript/spot_sbe/AccountResponse.ts new file mode 100644 index 0000000000..625c03ea64 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/AccountResponse.ts @@ -0,0 +1,228 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Balances { + exponent: number; + free: bigint; + locked: bigint; +} + +export interface Permissions { +} + +export interface ReduceOnlyAssets { +} + +export interface AccountResponse { + commissionExponent: number; + commissionRateMaker: bigint; + commissionRateTaker: bigint; + commissionRateBuyer: bigint; + commissionRateSeller: bigint; + canTrade: number; + canWithdraw: number; + canDeposit: number; + brokered: number; + requireSelfTradePrevention: number; + preventSor: number; + updateTime: bigint; + accountType: number; + tradeGroupId: bigint; + uid: bigint; + balances: Balances[]; + permissions: Permissions[]; + reduceOnlyAssets: ReduceOnlyAssets[]; +} + +export class AccountResponseDecoder { + private static readonly BLOCK_LENGTH = 64; + private static readonly TEMPLATE_ID = 400; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): AccountResponse { + const view = new DataView(buffer); + let pos = offset; + + const commissionExponent = view.getInt8(pos); + pos += 1; + + const commissionRateMaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const commissionRateTaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const commissionRateBuyer = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const commissionRateSeller = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const canTrade = view.getUint8(pos); + pos += 1; + + const canWithdraw = view.getUint8(pos); + pos += 1; + + const canDeposit = view.getUint8(pos); + pos += 1; + + const brokered = view.getUint8(pos); + pos += 1; + + const requireSelfTradePrevention = view.getUint8(pos); + pos += 1; + + const preventSor = view.getUint8(pos); + pos += 1; + + const updateTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const accountType = view.getUint8(pos); + pos += 1; + + const tradeGroupId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const uid = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + AccountResponseDecoder.BLOCK_LENGTH; + + const balances = this.decodeBalancesGroup(view, pos); + pos = balances.nextOffset; + + const permissions = this.decodePermissionsGroup(view, pos); + pos = permissions.nextOffset; + + const reduceOnlyAssets = this.decodeReduceOnlyAssetsGroup(view, pos); + pos = reduceOnlyAssets.nextOffset; + + return { + commissionExponent: commissionExponent, + commissionRateMaker: commissionRateMaker, + commissionRateTaker: commissionRateTaker, + commissionRateBuyer: commissionRateBuyer, + commissionRateSeller: commissionRateSeller, + canTrade: canTrade, + canWithdraw: canWithdraw, + canDeposit: canDeposit, + brokered: brokered, + requireSelfTradePrevention: requireSelfTradePrevention, + preventSor: preventSor, + updateTime: updateTime, + accountType: accountType, + tradeGroupId: tradeGroupId, + uid: uid, + balances: balances.items, + permissions: permissions.items, + reduceOnlyAssets: reduceOnlyAssets.items + }; + } + private decodeBalancesGroup(view: DataView, offset: number): { items: Balances[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Balances[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const exponent = view.getInt8(pos); + pos += 1; + + const free = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const locked = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + exponent: exponent, + free: free, + locked: locked + }); + } + + return { items, nextOffset: pos }; + } + private decodePermissionsGroup(view: DataView, offset: number): { items: Permissions[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Permissions[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + }); + } + + return { items, nextOffset: pos }; + } + private decodeReduceOnlyAssetsGroup(view: DataView, offset: number): { items: ReduceOnlyAssets[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: ReduceOnlyAssets[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return AccountResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return AccountResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return AccountResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return AccountResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/AccountTradesResponse.ts b/binance/generated-typescript/spot_sbe/AccountTradesResponse.ts new file mode 100644 index 0000000000..968be5c08f --- /dev/null +++ b/binance/generated-typescript/spot_sbe/AccountTradesResponse.ts @@ -0,0 +1,148 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Trades { + priceExponent: number; + qtyExponent: number; + commissionExponent: number; + id: bigint; + orderId: bigint; + orderListId: bigint; + price: bigint; + qty: bigint; + quoteQty: bigint; + commission: bigint; + time: bigint; + isBuyer: number; + isMaker: number; + isBestMatch: number; +} + +export interface AccountTradesResponse { + trades: Trades[]; +} + +export class AccountTradesResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 401; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): AccountTradesResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + AccountTradesResponseDecoder.BLOCK_LENGTH; + + const trades = this.decodeTradesGroup(view, pos); + pos = trades.nextOffset; + + return { + trades: trades.items + }; + } + private decodeTradesGroup(view: DataView, offset: number): { items: Trades[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Trades[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const commissionExponent = view.getInt8(pos); + pos += 1; + + const id = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const quoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const commission = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const time = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const isBuyer = view.getUint8(pos); + pos += 1; + + const isMaker = view.getUint8(pos); + pos += 1; + + const isBestMatch = view.getUint8(pos); + pos += 1; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + priceExponent: priceExponent, + qtyExponent: qtyExponent, + commissionExponent: commissionExponent, + id: id, + orderId: orderId, + orderListId: orderListId, + price: price, + qty: qty, + quoteQty: quoteQty, + commission: commission, + time: time, + isBuyer: isBuyer, + isMaker: isMaker, + isBestMatch: isBestMatch + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return AccountTradesResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return AccountTradesResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return AccountTradesResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return AccountTradesResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/AccountType.ts b/binance/generated-typescript/spot_sbe/AccountType.ts new file mode 100644 index 0000000000..ac4b3827e3 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/AccountType.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum AccountType { + Spot = 0, + Unknown = 2, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/AggTradesResponse.ts b/binance/generated-typescript/spot_sbe/AggTradesResponse.ts new file mode 100644 index 0000000000..3f7397a340 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/AggTradesResponse.ts @@ -0,0 +1,128 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface AggTrades { + aggTradeId: bigint; + price: bigint; + qty: bigint; + firstTradeId: bigint; + lastTradeId: bigint; + time: bigint; + isBuyerMaker: number; + isBestMatch: number; +} + +export interface AggTradesResponse { + priceExponent: number; + qtyExponent: number; + aggTrades: AggTrades[]; +} + +export class AggTradesResponseDecoder { + private static readonly BLOCK_LENGTH = 2; + private static readonly TEMPLATE_ID = 202; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): AggTradesResponse { + const view = new DataView(buffer); + let pos = offset; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + // Skip to end of block for forward compatibility + pos = offset + AggTradesResponseDecoder.BLOCK_LENGTH; + + const aggTrades = this.decodeAggTradesGroup(view, pos); + pos = aggTrades.nextOffset; + + return { + priceExponent: priceExponent, + qtyExponent: qtyExponent, + aggTrades: aggTrades.items + }; + } + private decodeAggTradesGroup(view: DataView, offset: number): { items: AggTrades[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: AggTrades[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const aggTradeId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const firstTradeId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastTradeId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const time = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const isBuyerMaker = view.getUint8(pos); + pos += 1; + + const isBestMatch = view.getUint8(pos); + pos += 1; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + aggTradeId: aggTradeId, + price: price, + qty: qty, + firstTradeId: firstTradeId, + lastTradeId: lastTradeId, + time: time, + isBuyerMaker: isBuyerMaker, + isBestMatch: isBestMatch + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return AggTradesResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return AggTradesResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return AggTradesResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return AggTradesResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/AllocationType.ts b/binance/generated-typescript/spot_sbe/AllocationType.ts new file mode 100644 index 0000000000..f88434eb36 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/AllocationType.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum AllocationType { + Unknown = 0, + Sor = 2, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/AllowedSelfTradePreventionModes.ts b/binance/generated-typescript/spot_sbe/AllowedSelfTradePreventionModes.ts new file mode 100644 index 0000000000..cd5fa916cb --- /dev/null +++ b/binance/generated-typescript/spot_sbe/AllowedSelfTradePreventionModes.ts @@ -0,0 +1,35 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface AllowedSelfTradePreventionModes { + none: boolean; + expireTaker: boolean; + expireMaker: boolean; + expireBoth: boolean; + decrement: boolean; + transfer: boolean; + nonRepresentable: boolean; +} + +export class AllowedSelfTradePreventionModesDecoder { + static decode(view: DataView, offset: number, littleEndian: boolean): AllowedSelfTradePreventionModes { + const bits = view.getUint8(offset); + + return { + none: (bits & (1 << 0)) !== 0, + expireTaker: (bits & (1 << 1)) !== 0, + expireMaker: (bits & (1 << 2)) !== 0, + expireBoth: (bits & (1 << 3)) !== 0, + decrement: (bits & (1 << 4)) !== 0, + transfer: (bits & (1 << 5)) !== 0, + nonRepresentable: (bits & (1 << 7)) !== 0 + }; + } + + static getEncodedLength(): number { + return 1; + } +} diff --git a/binance/generated-typescript/spot_sbe/AveragePriceResponse.ts b/binance/generated-typescript/spot_sbe/AveragePriceResponse.ts new file mode 100644 index 0000000000..1a8eb63934 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/AveragePriceResponse.ts @@ -0,0 +1,68 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface AveragePriceResponse { + mins: bigint; + priceExponent: number; + price: bigint; + closeTime: bigint; +} + +export class AveragePriceResponseDecoder { + private static readonly BLOCK_LENGTH = 25; + private static readonly TEMPLATE_ID = 204; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): AveragePriceResponse { + const view = new DataView(buffer); + let pos = offset; + + const mins = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const closeTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + AveragePriceResponseDecoder.BLOCK_LENGTH; + + return { + mins: mins, + priceExponent: priceExponent, + price: price, + closeTime: closeTime + }; + } + + static getBlockLength(): number { + return AveragePriceResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return AveragePriceResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return AveragePriceResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return AveragePriceResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/BalanceUpdateEvent.ts b/binance/generated-typescript/spot_sbe/BalanceUpdateEvent.ts new file mode 100644 index 0000000000..642efaa83a --- /dev/null +++ b/binance/generated-typescript/spot_sbe/BalanceUpdateEvent.ts @@ -0,0 +1,90 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface BalanceUpdateEvent { + eventTime: bigint; + clearTime: bigint; + qtyExponent: number; + freeQtyDelta: bigint; + subscriptionId: number; + asset: Uint8Array; +} + +export class BalanceUpdateEventDecoder { + private static readonly BLOCK_LENGTH = 27; + private static readonly TEMPLATE_ID = 601; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): BalanceUpdateEvent { + const view = new DataView(buffer); + let pos = offset; + + const eventTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const clearTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const freeQtyDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const subscriptionId = view.getUint16(pos, this.littleEndian); + pos += 2; + + // Skip to end of block for forward compatibility + pos = offset + BalanceUpdateEventDecoder.BLOCK_LENGTH; + + const asset = this.decodeVarData(view, pos); + pos = asset.nextOffset; + + return { + eventTime: eventTime, + clearTime: clearTime, + qtyExponent: qtyExponent, + freeQtyDelta: freeQtyDelta, + subscriptionId: subscriptionId, + asset: asset.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return BalanceUpdateEventDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return BalanceUpdateEventDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return BalanceUpdateEventDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return BalanceUpdateEventDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/BookTickerResponse.ts b/binance/generated-typescript/spot_sbe/BookTickerResponse.ts new file mode 100644 index 0000000000..1406441416 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/BookTickerResponse.ts @@ -0,0 +1,108 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Tickers { + priceExponent: number; + qtyExponent: number; + bidPrice: bigint; + bidQty: bigint; + askPrice: bigint; + askQty: bigint; +} + +export interface BookTickerResponse { + tickers: Tickers[]; +} + +export class BookTickerResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 212; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): BookTickerResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + BookTickerResponseDecoder.BLOCK_LENGTH; + + const tickers = this.decodeTickersGroup(view, pos); + pos = tickers.nextOffset; + + return { + tickers: tickers.items + }; + } + private decodeTickersGroup(view: DataView, offset: number): { items: Tickers[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Tickers[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const bidPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const bidQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const askPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const askQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + priceExponent: priceExponent, + qtyExponent: qtyExponent, + bidPrice: bidPrice, + bidQty: bidQty, + askPrice: askPrice, + askQty: askQty + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return BookTickerResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return BookTickerResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return BookTickerResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return BookTickerResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/BookTickerSymbolResponse.ts b/binance/generated-typescript/spot_sbe/BookTickerSymbolResponse.ts new file mode 100644 index 0000000000..310d0b0c75 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/BookTickerSymbolResponse.ts @@ -0,0 +1,95 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface BookTickerSymbolResponse { + priceExponent: number; + qtyExponent: number; + bidPrice: bigint; + bidQty: bigint; + askPrice: bigint; + askQty: bigint; + symbol: Uint8Array; +} + +export class BookTickerSymbolResponseDecoder { + private static readonly BLOCK_LENGTH = 34; + private static readonly TEMPLATE_ID = 211; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): BookTickerSymbolResponse { + const view = new DataView(buffer); + let pos = offset; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const bidPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const bidQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const askPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const askQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + BookTickerSymbolResponseDecoder.BLOCK_LENGTH; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + return { + priceExponent: priceExponent, + qtyExponent: qtyExponent, + bidPrice: bidPrice, + bidQty: bidQty, + askPrice: askPrice, + askQty: askQty, + symbol: symbol.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return BookTickerSymbolResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return BookTickerSymbolResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return BookTickerSymbolResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return BookTickerSymbolResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/BoolEnum.ts b/binance/generated-typescript/spot_sbe/BoolEnum.ts new file mode 100644 index 0000000000..2824154952 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/BoolEnum.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum BoolEnum { + False = 0, + True = 1 +} diff --git a/binance/generated-typescript/spot_sbe/CancelOpenOrdersResponse.ts b/binance/generated-typescript/spot_sbe/CancelOpenOrdersResponse.ts new file mode 100644 index 0000000000..6e017b62d7 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/CancelOpenOrdersResponse.ts @@ -0,0 +1,78 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Responses { +} + +export interface CancelOpenOrdersResponse { + responses: Responses[]; +} + +export class CancelOpenOrdersResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 306; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): CancelOpenOrdersResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + CancelOpenOrdersResponseDecoder.BLOCK_LENGTH; + + const responses = this.decodeResponsesGroup(view, pos); + pos = responses.nextOffset; + + return { + responses: responses.items + }; + } + private decodeResponsesGroup(view: DataView, offset: number): { items: Responses[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Responses[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return CancelOpenOrdersResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return CancelOpenOrdersResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return CancelOpenOrdersResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return CancelOpenOrdersResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/CancelOrderListResponse.ts b/binance/generated-typescript/spot_sbe/CancelOrderListResponse.ts new file mode 100644 index 0000000000..fd47f84a7c --- /dev/null +++ b/binance/generated-typescript/spot_sbe/CancelOrderListResponse.ts @@ -0,0 +1,305 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Orders { + orderId: bigint; +} + +export interface OrderReports { + orderId: bigint; + orderListId: bigint; + transactTime: bigint; + price: bigint; + origQty: bigint; + executedQty: bigint; + cummulativeQuoteQty: bigint; + status: number; + timeInForce: number; + orderType: number; + side: number; + stopPrice: bigint; + trailingDelta: bigint; + trailingTime: bigint; + icebergQty: bigint; + strategyId: bigint; + strategyType: number; + orderCapacity: number; + workingFloor: number; + selfTradePreventionMode: number; + preventedQuantity: bigint; + usedSor: number; + origQuoteOrderQty: bigint; + pegPriceType: number; + pegOffsetType: number; + pegOffsetValue: number; + peggedPrice: bigint; +} + +export interface CancelOrderListResponse { + orderListId: bigint; + contingencyType: number; + listStatusType: number; + listOrderStatus: number; + transactionTime: bigint; + priceExponent: number; + qtyExponent: number; + orders: Orders[]; + orderReports: OrderReports[]; + listClientOrderId: Uint8Array; + symbol: Uint8Array; +} + +export class CancelOrderListResponseDecoder { + private static readonly BLOCK_LENGTH = 21; + private static readonly TEMPLATE_ID = 312; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): CancelOrderListResponse { + const view = new DataView(buffer); + let pos = offset; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const contingencyType = view.getUint8(pos); + pos += 1; + + const listStatusType = view.getUint8(pos); + pos += 1; + + const listOrderStatus = view.getUint8(pos); + pos += 1; + + const transactionTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + // Skip to end of block for forward compatibility + pos = offset + CancelOrderListResponseDecoder.BLOCK_LENGTH; + + const orders = this.decodeOrdersGroup(view, pos); + pos = orders.nextOffset; + + const orderReports = this.decodeOrderReportsGroup(view, pos); + pos = orderReports.nextOffset; + + const listClientOrderId = this.decodeVarData(view, pos); + pos = listClientOrderId.nextOffset; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + return { + orderListId: orderListId, + contingencyType: contingencyType, + listStatusType: listStatusType, + listOrderStatus: listOrderStatus, + transactionTime: transactionTime, + priceExponent: priceExponent, + qtyExponent: qtyExponent, + orders: orders.items, + orderReports: orderReports.items, + listClientOrderId: listClientOrderId.value, + symbol: symbol.value + }; + } + private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: Orders[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderId: orderId + }); + } + + return { items, nextOffset: pos }; + } + private decodeOrderReportsGroup(view: DataView, offset: number): { items: OrderReports[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: OrderReports[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const transactTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const origQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const status = view.getUint8(pos); + pos += 1; + + const timeInForce = view.getUint8(pos); + pos += 1; + + const orderType = view.getUint8(pos); + pos += 1; + + const side = view.getUint8(pos); + pos += 1; + + const stopPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const icebergQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyType = view.getInt32(pos, this.littleEndian); + pos += 4; + + const orderCapacity = view.getUint8(pos); + pos += 1; + + const workingFloor = view.getUint8(pos); + pos += 1; + + const selfTradePreventionMode = view.getUint8(pos); + pos += 1; + + const preventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const usedSor = view.getUint8(pos); + pos += 1; + + const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const pegPriceType = view.getUint8(pos); + pos += 1; + + const pegOffsetType = view.getUint8(pos); + pos += 1; + + const pegOffsetValue = view.getUint8(pos); + pos += 1; + + const peggedPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderId: orderId, + orderListId: orderListId, + transactTime: transactTime, + price: price, + origQty: origQty, + executedQty: executedQty, + cummulativeQuoteQty: cummulativeQuoteQty, + status: status, + timeInForce: timeInForce, + orderType: orderType, + side: side, + stopPrice: stopPrice, + trailingDelta: trailingDelta, + trailingTime: trailingTime, + icebergQty: icebergQty, + strategyId: strategyId, + strategyType: strategyType, + orderCapacity: orderCapacity, + workingFloor: workingFloor, + selfTradePreventionMode: selfTradePreventionMode, + preventedQuantity: preventedQuantity, + usedSor: usedSor, + origQuoteOrderQty: origQuoteOrderQty, + pegPriceType: pegPriceType, + pegOffsetType: pegOffsetType, + pegOffsetValue: pegOffsetValue, + peggedPrice: peggedPrice + }); + } + + return { items, nextOffset: pos }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return CancelOrderListResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return CancelOrderListResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return CancelOrderListResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return CancelOrderListResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/CancelOrderResponse.ts b/binance/generated-typescript/spot_sbe/CancelOrderResponse.ts new file mode 100644 index 0000000000..21b8747e42 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/CancelOrderResponse.ts @@ -0,0 +1,220 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface CancelOrderResponse { + priceExponent: number; + qtyExponent: number; + orderId: bigint; + orderListId: bigint; + transactTime: bigint; + price: bigint; + origQty: bigint; + executedQty: bigint; + cummulativeQuoteQty: bigint; + status: number; + timeInForce: number; + orderType: number; + side: number; + stopPrice: bigint; + trailingDelta: bigint; + trailingTime: bigint; + icebergQty: bigint; + strategyId: bigint; + strategyType: number; + orderCapacity: number; + workingFloor: number; + selfTradePreventionMode: number; + preventedQuantity: bigint; + usedSor: number; + origQuoteOrderQty: bigint; + pegPriceType: number; + pegOffsetType: number; + pegOffsetValue: number; + peggedPrice: bigint; + symbol: Uint8Array; + origClientOrderId: Uint8Array; + clientOrderId: Uint8Array; +} + +export class CancelOrderResponseDecoder { + private static readonly BLOCK_LENGTH = 137; + private static readonly TEMPLATE_ID = 305; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): CancelOrderResponse { + const view = new DataView(buffer); + let pos = offset; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const transactTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const origQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const status = view.getUint8(pos); + pos += 1; + + const timeInForce = view.getUint8(pos); + pos += 1; + + const orderType = view.getUint8(pos); + pos += 1; + + const side = view.getUint8(pos); + pos += 1; + + const stopPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const icebergQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyType = view.getInt32(pos, this.littleEndian); + pos += 4; + + const orderCapacity = view.getUint8(pos); + pos += 1; + + const workingFloor = view.getUint8(pos); + pos += 1; + + const selfTradePreventionMode = view.getUint8(pos); + pos += 1; + + const preventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const usedSor = view.getUint8(pos); + pos += 1; + + const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const pegPriceType = view.getUint8(pos); + pos += 1; + + const pegOffsetType = view.getUint8(pos); + pos += 1; + + const pegOffsetValue = view.getUint8(pos); + pos += 1; + + const peggedPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + CancelOrderResponseDecoder.BLOCK_LENGTH; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + const origClientOrderId = this.decodeVarData(view, pos); + pos = origClientOrderId.nextOffset; + + const clientOrderId = this.decodeVarData(view, pos); + pos = clientOrderId.nextOffset; + + return { + priceExponent: priceExponent, + qtyExponent: qtyExponent, + orderId: orderId, + orderListId: orderListId, + transactTime: transactTime, + price: price, + origQty: origQty, + executedQty: executedQty, + cummulativeQuoteQty: cummulativeQuoteQty, + status: status, + timeInForce: timeInForce, + orderType: orderType, + side: side, + stopPrice: stopPrice, + trailingDelta: trailingDelta, + trailingTime: trailingTime, + icebergQty: icebergQty, + strategyId: strategyId, + strategyType: strategyType, + orderCapacity: orderCapacity, + workingFloor: workingFloor, + selfTradePreventionMode: selfTradePreventionMode, + preventedQuantity: preventedQuantity, + usedSor: usedSor, + origQuoteOrderQty: origQuoteOrderQty, + pegPriceType: pegPriceType, + pegOffsetType: pegOffsetType, + pegOffsetValue: pegOffsetValue, + peggedPrice: peggedPrice, + symbol: symbol.value, + origClientOrderId: origClientOrderId.value, + clientOrderId: clientOrderId.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return CancelOrderResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return CancelOrderResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return CancelOrderResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return CancelOrderResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/CancelReplaceOrderResponse.ts b/binance/generated-typescript/spot_sbe/CancelReplaceOrderResponse.ts new file mode 100644 index 0000000000..406d595c3b --- /dev/null +++ b/binance/generated-typescript/spot_sbe/CancelReplaceOrderResponse.ts @@ -0,0 +1,80 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface CancelReplaceOrderResponse { + cancelResult: number; + newOrderResult: number; + cancelResponse: Uint8Array; + newOrderResponse: Uint8Array; +} + +export class CancelReplaceOrderResponseDecoder { + private static readonly BLOCK_LENGTH = 2; + private static readonly TEMPLATE_ID = 307; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): CancelReplaceOrderResponse { + const view = new DataView(buffer); + let pos = offset; + + const cancelResult = view.getUint8(pos); + pos += 1; + + const newOrderResult = view.getUint8(pos); + pos += 1; + + // Skip to end of block for forward compatibility + pos = offset + CancelReplaceOrderResponseDecoder.BLOCK_LENGTH; + + const cancelResponse = this.decodeVarData(view, pos); + pos = cancelResponse.nextOffset; + + const newOrderResponse = this.decodeVarData(view, pos); + pos = newOrderResponse.nextOffset; + + return { + cancelResult: cancelResult, + newOrderResult: newOrderResult, + cancelResponse: cancelResponse.value, + newOrderResponse: newOrderResponse.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return CancelReplaceOrderResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return CancelReplaceOrderResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return CancelReplaceOrderResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return CancelReplaceOrderResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/CancelReplaceStatus.ts b/binance/generated-typescript/spot_sbe/CancelReplaceStatus.ts new file mode 100644 index 0000000000..5f7f82f55b --- /dev/null +++ b/binance/generated-typescript/spot_sbe/CancelReplaceStatus.ts @@ -0,0 +1,12 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum CancelReplaceStatus { + Success = 0, + Failure = 1, + NotAttempted = 2, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/ContingencyType.ts b/binance/generated-typescript/spot_sbe/ContingencyType.ts new file mode 100644 index 0000000000..297070be7a --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ContingencyType.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum ContingencyType { + Oco = 1, + Oto = 2, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/DepthResponse.ts b/binance/generated-typescript/spot_sbe/DepthResponse.ts new file mode 100644 index 0000000000..afe218af67 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/DepthResponse.ts @@ -0,0 +1,143 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Bids { + price: bigint; + qty: bigint; +} + +export interface Asks { + price: bigint; + qty: bigint; +} + +export interface DepthResponse { + lastUpdateId: bigint; + priceExponent: number; + qtyExponent: number; + bids: Bids[]; + asks: Asks[]; +} + +export class DepthResponseDecoder { + private static readonly BLOCK_LENGTH = 10; + private static readonly TEMPLATE_ID = 200; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): DepthResponse { + const view = new DataView(buffer); + let pos = offset; + + const lastUpdateId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + // Skip to end of block for forward compatibility + pos = offset + DepthResponseDecoder.BLOCK_LENGTH; + + const bids = this.decodeBidsGroup(view, pos); + pos = bids.nextOffset; + + const asks = this.decodeAsksGroup(view, pos); + pos = asks.nextOffset; + + return { + lastUpdateId: lastUpdateId, + priceExponent: priceExponent, + qtyExponent: qtyExponent, + bids: bids.items, + asks: asks.items + }; + } + private decodeBidsGroup(view: DataView, offset: number): { items: Bids[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Bids[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + price: price, + qty: qty + }); + } + + return { items, nextOffset: pos }; + } + private decodeAsksGroup(view: DataView, offset: number): { items: Asks[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Asks[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + price: price, + qty: qty + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return DepthResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return DepthResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return DepthResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return DepthResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/ErrorResponse.ts b/binance/generated-typescript/spot_sbe/ErrorResponse.ts new file mode 100644 index 0000000000..6690d1eed4 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ErrorResponse.ts @@ -0,0 +1,85 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface ErrorResponse { + code: number; + serverTime: bigint; + retryAfter: bigint; + msg: Uint8Array; + data: Uint8Array; +} + +export class ErrorResponseDecoder { + private static readonly BLOCK_LENGTH = 18; + private static readonly TEMPLATE_ID = 100; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): ErrorResponse { + const view = new DataView(buffer); + let pos = offset; + + const code = view.getInt16(pos, this.littleEndian); + pos += 2; + + const serverTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const retryAfter = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + ErrorResponseDecoder.BLOCK_LENGTH; + + const msg = this.decodeVarData(view, pos); + pos = msg.nextOffset; + + const data = this.decodeVarData(view, pos); + pos = data.nextOffset; + + return { + code: code, + serverTime: serverTime, + retryAfter: retryAfter, + msg: msg.value, + data: data.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return ErrorResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return ErrorResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return ErrorResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return ErrorResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/EventStreamTerminatedEvent.ts b/binance/generated-typescript/spot_sbe/EventStreamTerminatedEvent.ts new file mode 100644 index 0000000000..0dd8be5a68 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/EventStreamTerminatedEvent.ts @@ -0,0 +1,58 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface EventStreamTerminatedEvent { + eventTime: bigint; + subscriptionId: number; +} + +export class EventStreamTerminatedEventDecoder { + private static readonly BLOCK_LENGTH = 10; + private static readonly TEMPLATE_ID = 602; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): EventStreamTerminatedEvent { + const view = new DataView(buffer); + let pos = offset; + + const eventTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const subscriptionId = view.getUint16(pos, this.littleEndian); + pos += 2; + + // Skip to end of block for forward compatibility + pos = offset + EventStreamTerminatedEventDecoder.BLOCK_LENGTH; + + return { + eventTime: eventTime, + subscriptionId: subscriptionId + }; + } + + static getBlockLength(): number { + return EventStreamTerminatedEventDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return EventStreamTerminatedEventDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return EventStreamTerminatedEventDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return EventStreamTerminatedEventDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/ExchangeInfoResponse.ts b/binance/generated-typescript/spot_sbe/ExchangeInfoResponse.ts new file mode 100644 index 0000000000..d21b0ddc02 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ExchangeInfoResponse.ts @@ -0,0 +1,278 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface RateLimits { + rateLimitType: number; + interval: number; + intervalNum: number; + rateLimit: bigint; +} + +export interface ExchangeFilters { +} + +export interface Symbols { + status: number; + baseAssetPrecision: number; + quoteAssetPrecision: number; + baseCommissionPrecision: number; + quoteCommissionPrecision: number; + orderTypes: number; + icebergAllowed: number; + ocoAllowed: number; + otoAllowed: number; + quoteOrderQtyMarketAllowed: number; + allowTrailingStop: number; + cancelReplaceAllowed: number; + amendAllowed: number; + isSpotTradingAllowed: number; + isMarginTradingAllowed: number; + defaultSelfTradePreventionMode: number; + allowedSelfTradePreventionModes: number; + pegInstructionsAllowed: number; +} + +export interface Sors { +} + +export interface ExchangeInfoResponse { + rateLimits: RateLimits[]; + exchangeFilters: ExchangeFilters[]; + symbols: Symbols[]; + sors: Sors[]; +} + +export class ExchangeInfoResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 103; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): ExchangeInfoResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + ExchangeInfoResponseDecoder.BLOCK_LENGTH; + + const rateLimits = this.decodeRateLimitsGroup(view, pos); + pos = rateLimits.nextOffset; + + const exchangeFilters = this.decodeExchangeFiltersGroup(view, pos); + pos = exchangeFilters.nextOffset; + + const symbols = this.decodeSymbolsGroup(view, pos); + pos = symbols.nextOffset; + + const sors = this.decodeSorsGroup(view, pos); + pos = sors.nextOffset; + + return { + rateLimits: rateLimits.items, + exchangeFilters: exchangeFilters.items, + symbols: symbols.items, + sors: sors.items + }; + } + private decodeRateLimitsGroup(view: DataView, offset: number): { items: RateLimits[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: RateLimits[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const rateLimitType = view.getUint8(pos); + pos += 1; + + const interval = view.getUint8(pos); + pos += 1; + + const intervalNum = view.getUint8(pos); + pos += 1; + + const rateLimit = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + rateLimitType: rateLimitType, + interval: interval, + intervalNum: intervalNum, + rateLimit: rateLimit + }); + } + + return { items, nextOffset: pos }; + } + private decodeExchangeFiltersGroup(view: DataView, offset: number): { items: ExchangeFilters[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: ExchangeFilters[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + }); + } + + return { items, nextOffset: pos }; + } + private decodeSymbolsGroup(view: DataView, offset: number): { items: Symbols[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Symbols[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const status = view.getUint8(pos); + pos += 1; + + const baseAssetPrecision = view.getUint8(pos); + pos += 1; + + const quoteAssetPrecision = view.getUint8(pos); + pos += 1; + + const baseCommissionPrecision = view.getUint8(pos); + pos += 1; + + const quoteCommissionPrecision = view.getUint8(pos); + pos += 1; + + const orderTypes = view.getUint16(pos, this.littleEndian); + pos += 2; + + const icebergAllowed = view.getUint8(pos); + pos += 1; + + const ocoAllowed = view.getUint8(pos); + pos += 1; + + const otoAllowed = view.getUint8(pos); + pos += 1; + + const quoteOrderQtyMarketAllowed = view.getUint8(pos); + pos += 1; + + const allowTrailingStop = view.getUint8(pos); + pos += 1; + + const cancelReplaceAllowed = view.getUint8(pos); + pos += 1; + + const amendAllowed = view.getUint8(pos); + pos += 1; + + const isSpotTradingAllowed = view.getUint8(pos); + pos += 1; + + const isMarginTradingAllowed = view.getUint8(pos); + pos += 1; + + const defaultSelfTradePreventionMode = view.getUint8(pos); + pos += 1; + + const allowedSelfTradePreventionModes = view.getUint8(pos); + pos += 1; + + const pegInstructionsAllowed = view.getUint8(pos); + pos += 1; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + status: status, + baseAssetPrecision: baseAssetPrecision, + quoteAssetPrecision: quoteAssetPrecision, + baseCommissionPrecision: baseCommissionPrecision, + quoteCommissionPrecision: quoteCommissionPrecision, + orderTypes: orderTypes, + icebergAllowed: icebergAllowed, + ocoAllowed: ocoAllowed, + otoAllowed: otoAllowed, + quoteOrderQtyMarketAllowed: quoteOrderQtyMarketAllowed, + allowTrailingStop: allowTrailingStop, + cancelReplaceAllowed: cancelReplaceAllowed, + amendAllowed: amendAllowed, + isSpotTradingAllowed: isSpotTradingAllowed, + isMarginTradingAllowed: isMarginTradingAllowed, + defaultSelfTradePreventionMode: defaultSelfTradePreventionMode, + allowedSelfTradePreventionModes: allowedSelfTradePreventionModes, + pegInstructionsAllowed: pegInstructionsAllowed + }); + } + + return { items, nextOffset: pos }; + } + private decodeSorsGroup(view: DataView, offset: number): { items: Sors[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Sors[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return ExchangeInfoResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return ExchangeInfoResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return ExchangeInfoResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return ExchangeInfoResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/ExchangeMaxNumAlgoOrdersFilter.ts b/binance/generated-typescript/spot_sbe/ExchangeMaxNumAlgoOrdersFilter.ts new file mode 100644 index 0000000000..51da8b74f6 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ExchangeMaxNumAlgoOrdersFilter.ts @@ -0,0 +1,58 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface ExchangeMaxNumAlgoOrdersFilter { + filterType: number; + maxNumAlgoOrders: bigint; +} + +export class ExchangeMaxNumAlgoOrdersFilterDecoder { + private static readonly BLOCK_LENGTH = 8; + private static readonly TEMPLATE_ID = 16; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): ExchangeMaxNumAlgoOrdersFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const maxNumAlgoOrders = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + ExchangeMaxNumAlgoOrdersFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + maxNumAlgoOrders: maxNumAlgoOrders + }; + } + + static getBlockLength(): number { + return ExchangeMaxNumAlgoOrdersFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return ExchangeMaxNumAlgoOrdersFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return ExchangeMaxNumAlgoOrdersFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return ExchangeMaxNumAlgoOrdersFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/ExchangeMaxNumIcebergOrdersFilter.ts b/binance/generated-typescript/spot_sbe/ExchangeMaxNumIcebergOrdersFilter.ts new file mode 100644 index 0000000000..7c18416b81 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ExchangeMaxNumIcebergOrdersFilter.ts @@ -0,0 +1,58 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface ExchangeMaxNumIcebergOrdersFilter { + filterType: number; + maxNumIcebergOrders: bigint; +} + +export class ExchangeMaxNumIcebergOrdersFilterDecoder { + private static readonly BLOCK_LENGTH = 8; + private static readonly TEMPLATE_ID = 17; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): ExchangeMaxNumIcebergOrdersFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const maxNumIcebergOrders = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + ExchangeMaxNumIcebergOrdersFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + maxNumIcebergOrders: maxNumIcebergOrders + }; + } + + static getBlockLength(): number { + return ExchangeMaxNumIcebergOrdersFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return ExchangeMaxNumIcebergOrdersFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return ExchangeMaxNumIcebergOrdersFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return ExchangeMaxNumIcebergOrdersFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/ExchangeMaxNumOrderListsFilter.ts b/binance/generated-typescript/spot_sbe/ExchangeMaxNumOrderListsFilter.ts new file mode 100644 index 0000000000..b965f6831b --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ExchangeMaxNumOrderListsFilter.ts @@ -0,0 +1,58 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface ExchangeMaxNumOrderListsFilter { + filterType: number; + maxNumOrderLists: bigint; +} + +export class ExchangeMaxNumOrderListsFilterDecoder { + private static readonly BLOCK_LENGTH = 8; + private static readonly TEMPLATE_ID = 19; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): ExchangeMaxNumOrderListsFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const maxNumOrderLists = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + ExchangeMaxNumOrderListsFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + maxNumOrderLists: maxNumOrderLists + }; + } + + static getBlockLength(): number { + return ExchangeMaxNumOrderListsFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return ExchangeMaxNumOrderListsFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return ExchangeMaxNumOrderListsFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return ExchangeMaxNumOrderListsFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/ExchangeMaxNumOrdersFilter.ts b/binance/generated-typescript/spot_sbe/ExchangeMaxNumOrdersFilter.ts new file mode 100644 index 0000000000..a4412220e9 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ExchangeMaxNumOrdersFilter.ts @@ -0,0 +1,58 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface ExchangeMaxNumOrdersFilter { + filterType: number; + maxNumOrders: bigint; +} + +export class ExchangeMaxNumOrdersFilterDecoder { + private static readonly BLOCK_LENGTH = 8; + private static readonly TEMPLATE_ID = 15; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): ExchangeMaxNumOrdersFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const maxNumOrders = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + ExchangeMaxNumOrdersFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + maxNumOrders: maxNumOrders + }; + } + + static getBlockLength(): number { + return ExchangeMaxNumOrdersFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return ExchangeMaxNumOrdersFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return ExchangeMaxNumOrdersFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return ExchangeMaxNumOrdersFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/ExecutionReportEvent.ts b/binance/generated-typescript/spot_sbe/ExecutionReportEvent.ts new file mode 100644 index 0000000000..702dbbc6cb --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ExecutionReportEvent.ts @@ -0,0 +1,355 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface ExecutionReportEvent { + eventTime: bigint; + transactTime: bigint; + priceExponent: number; + qtyExponent: number; + commissionExponent: number; + orderCreationTime: bigint; + workingTime: bigint; + orderId: bigint; + orderListId: bigint; + origQty: bigint; + price: bigint; + origQuoteOrderQty: bigint; + icebergQty: bigint; + stopPrice: bigint; + orderType: number; + side: number; + timeInForce: number; + executionType: number; + orderStatus: number; + tradeId: bigint; + executionId: bigint; + executedQty: bigint; + cummulativeQuoteQty: bigint; + lastQty: bigint; + lastPrice: bigint; + quoteQty: bigint; + commission: bigint; + isWorking: number; + isMaker: number; + isBestMatch: number; + matchType: number; + selfTradePreventionMode: number; + orderCapacity: number; + workingFloor: number; + usedSor: number; + allocId: bigint; + trailingDelta: bigint; + trailingTime: bigint; + tradeGroupId: bigint; + preventedQty: bigint; + lastPreventedQty: bigint; + preventedMatchId: bigint; + preventedExecutionQty: bigint; + preventedExecutionPrice: bigint; + preventedExecutionQuoteQty: bigint; + strategyType: number; + strategyId: bigint; + counterOrderId: bigint; + subscriptionId: number; + pegPriceType: number; + pegOffsetType: number; + pegOffsetValue: number; + peggedPrice: bigint; + symbol: Uint8Array; + clientOrderId: Uint8Array; + origClientOrderId: Uint8Array; + commissionAsset: Uint8Array; + rejectReason: Uint8Array; + counterSymbol: Uint8Array; +} + +export class ExecutionReportEventDecoder { + private static readonly BLOCK_LENGTH = 281; + private static readonly TEMPLATE_ID = 603; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): ExecutionReportEvent { + const view = new DataView(buffer); + let pos = offset; + + const eventTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const transactTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const commissionExponent = view.getInt8(pos); + pos += 1; + + const orderCreationTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const workingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const origQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const icebergQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const stopPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderType = view.getUint8(pos); + pos += 1; + + const side = view.getUint8(pos); + pos += 1; + + const timeInForce = view.getUint8(pos); + pos += 1; + + const executionType = view.getUint8(pos); + pos += 1; + + const orderStatus = view.getUint8(pos); + pos += 1; + + const tradeId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executionId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const quoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const commission = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const isWorking = view.getUint8(pos); + pos += 1; + + const isMaker = view.getUint8(pos); + pos += 1; + + const isBestMatch = view.getUint8(pos); + pos += 1; + + const matchType = view.getUint8(pos); + pos += 1; + + const selfTradePreventionMode = view.getUint8(pos); + pos += 1; + + const orderCapacity = view.getUint8(pos); + pos += 1; + + const workingFloor = view.getUint8(pos); + pos += 1; + + const usedSor = view.getUint8(pos); + pos += 1; + + const allocId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingDelta = view.getBigUint64(pos, this.littleEndian); + pos += 8; + + const trailingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const tradeGroupId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastPreventedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedMatchId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedExecutionQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedExecutionPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedExecutionQuoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyType = view.getInt32(pos, this.littleEndian); + pos += 4; + + const strategyId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const counterOrderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const subscriptionId = view.getUint16(pos, this.littleEndian); + pos += 2; + + const pegPriceType = view.getUint8(pos); + pos += 1; + + const pegOffsetType = view.getUint8(pos); + pos += 1; + + const pegOffsetValue = view.getUint8(pos); + pos += 1; + + const peggedPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + ExecutionReportEventDecoder.BLOCK_LENGTH; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + const clientOrderId = this.decodeVarData(view, pos); + pos = clientOrderId.nextOffset; + + const origClientOrderId = this.decodeVarData(view, pos); + pos = origClientOrderId.nextOffset; + + const commissionAsset = this.decodeVarData(view, pos); + pos = commissionAsset.nextOffset; + + const rejectReason = this.decodeVarData(view, pos); + pos = rejectReason.nextOffset; + + const counterSymbol = this.decodeVarData(view, pos); + pos = counterSymbol.nextOffset; + + return { + eventTime: eventTime, + transactTime: transactTime, + priceExponent: priceExponent, + qtyExponent: qtyExponent, + commissionExponent: commissionExponent, + orderCreationTime: orderCreationTime, + workingTime: workingTime, + orderId: orderId, + orderListId: orderListId, + origQty: origQty, + price: price, + origQuoteOrderQty: origQuoteOrderQty, + icebergQty: icebergQty, + stopPrice: stopPrice, + orderType: orderType, + side: side, + timeInForce: timeInForce, + executionType: executionType, + orderStatus: orderStatus, + tradeId: tradeId, + executionId: executionId, + executedQty: executedQty, + cummulativeQuoteQty: cummulativeQuoteQty, + lastQty: lastQty, + lastPrice: lastPrice, + quoteQty: quoteQty, + commission: commission, + isWorking: isWorking, + isMaker: isMaker, + isBestMatch: isBestMatch, + matchType: matchType, + selfTradePreventionMode: selfTradePreventionMode, + orderCapacity: orderCapacity, + workingFloor: workingFloor, + usedSor: usedSor, + allocId: allocId, + trailingDelta: trailingDelta, + trailingTime: trailingTime, + tradeGroupId: tradeGroupId, + preventedQty: preventedQty, + lastPreventedQty: lastPreventedQty, + preventedMatchId: preventedMatchId, + preventedExecutionQty: preventedExecutionQty, + preventedExecutionPrice: preventedExecutionPrice, + preventedExecutionQuoteQty: preventedExecutionQuoteQty, + strategyType: strategyType, + strategyId: strategyId, + counterOrderId: counterOrderId, + subscriptionId: subscriptionId, + pegPriceType: pegPriceType, + pegOffsetType: pegOffsetType, + pegOffsetValue: pegOffsetValue, + peggedPrice: peggedPrice, + symbol: symbol.value, + clientOrderId: clientOrderId.value, + origClientOrderId: origClientOrderId.value, + commissionAsset: commissionAsset.value, + rejectReason: rejectReason.value, + counterSymbol: counterSymbol.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return ExecutionReportEventDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return ExecutionReportEventDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return ExecutionReportEventDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return ExecutionReportEventDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/ExecutionType.ts b/binance/generated-typescript/spot_sbe/ExecutionType.ts new file mode 100644 index 0000000000..4e12788b8d --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ExecutionType.ts @@ -0,0 +1,17 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum ExecutionType { + New = 0, + Canceled = 1, + Replaced = 2, + Rejected = 3, + Trade = 4, + Expired = 5, + TradePrevention = 8, + Unknown = 253, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/ExternalLockUpdateEvent.ts b/binance/generated-typescript/spot_sbe/ExternalLockUpdateEvent.ts new file mode 100644 index 0000000000..aaa0ee8020 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ExternalLockUpdateEvent.ts @@ -0,0 +1,90 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface ExternalLockUpdateEvent { + eventTime: bigint; + clearTime: bigint; + qtyExponent: number; + lockedQtyDelta: bigint; + subscriptionId: number; + asset: Uint8Array; +} + +export class ExternalLockUpdateEventDecoder { + private static readonly BLOCK_LENGTH = 27; + private static readonly TEMPLATE_ID = 604; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): ExternalLockUpdateEvent { + const view = new DataView(buffer); + let pos = offset; + + const eventTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const clearTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const lockedQtyDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const subscriptionId = view.getUint16(pos, this.littleEndian); + pos += 2; + + // Skip to end of block for forward compatibility + pos = offset + ExternalLockUpdateEventDecoder.BLOCK_LENGTH; + + const asset = this.decodeVarData(view, pos); + pos = asset.nextOffset; + + return { + eventTime: eventTime, + clearTime: clearTime, + qtyExponent: qtyExponent, + lockedQtyDelta: lockedQtyDelta, + subscriptionId: subscriptionId, + asset: asset.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return ExternalLockUpdateEventDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return ExternalLockUpdateEventDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return ExternalLockUpdateEventDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return ExternalLockUpdateEventDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/FilterType.ts b/binance/generated-typescript/spot_sbe/FilterType.ts new file mode 100644 index 0000000000..685e90d387 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/FilterType.ts @@ -0,0 +1,30 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum FilterType { + MaxPosition = 0, + PriceFilter = 1, + TPlusSell = 2, + LotSize = 3, + MaxNumOrders = 4, + MinNotional = 5, + MaxNumAlgoOrders = 6, + ExchangeMaxNumOrders = 7, + ExchangeMaxNumAlgoOrders = 8, + IcebergParts = 9, + MarketLotSize = 10, + PercentPrice = 11, + MaxNumIcebergOrders = 12, + ExchangeMaxNumIcebergOrders = 13, + TrailingDelta = 14, + PercentPriceBySide = 15, + Notional = 16, + MaxNumOrderLists = 17, + ExchangeMaxNumOrderLists = 18, + MaxNumOrderAmends = 19, + MaxAsset = 20, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/Floor.ts b/binance/generated-typescript/spot_sbe/Floor.ts new file mode 100644 index 0000000000..efeb4280b4 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/Floor.ts @@ -0,0 +1,12 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum Floor { + Exchange = 1, + Broker = 2, + Sor = 3, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/GroupSize16Encoding.ts b/binance/generated-typescript/spot_sbe/GroupSize16Encoding.ts new file mode 100644 index 0000000000..bc74bd9478 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/GroupSize16Encoding.ts @@ -0,0 +1,33 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface GroupSize16Encoding { + blockLength: number; + numInGroup: number; +} + +export class GroupSize16EncodingDecoder { + private static readonly ENCODED_LENGTH = 4; + + static decode(view: DataView, offset: number, littleEndian: boolean): GroupSize16Encoding { + let pos = offset; + + const blockLength = view.getUint16(pos, littleEndian); + pos += 2; + + const numInGroup = view.getUint16(pos, littleEndian); + pos += 2; + + return { + blockLength: blockLength, + numInGroup: numInGroup + }; + } + + static getEncodedLength(): number { + return GroupSize16EncodingDecoder.ENCODED_LENGTH; + } +} diff --git a/binance/generated-typescript/spot_sbe/GroupSizeEncoding.ts b/binance/generated-typescript/spot_sbe/GroupSizeEncoding.ts new file mode 100644 index 0000000000..bf6bc9016b --- /dev/null +++ b/binance/generated-typescript/spot_sbe/GroupSizeEncoding.ts @@ -0,0 +1,33 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface GroupSizeEncoding { + blockLength: number; + numInGroup: number; +} + +export class GroupSizeEncodingDecoder { + private static readonly ENCODED_LENGTH = 6; + + static decode(view: DataView, offset: number, littleEndian: boolean): GroupSizeEncoding { + let pos = offset; + + const blockLength = view.getUint16(pos, littleEndian); + pos += 2; + + const numInGroup = view.getUint32(pos, littleEndian); + pos += 4; + + return { + blockLength: blockLength, + numInGroup: numInGroup + }; + } + + static getEncodedLength(): number { + return GroupSizeEncodingDecoder.ENCODED_LENGTH; + } +} diff --git a/binance/generated-typescript/spot_sbe/IcebergPartsFilter.ts b/binance/generated-typescript/spot_sbe/IcebergPartsFilter.ts new file mode 100644 index 0000000000..da2c0473c6 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/IcebergPartsFilter.ts @@ -0,0 +1,58 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface IcebergPartsFilter { + filterType: number; + filterLimit: bigint; +} + +export class IcebergPartsFilterDecoder { + private static readonly BLOCK_LENGTH = 8; + private static readonly TEMPLATE_ID = 7; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): IcebergPartsFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const filterLimit = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + IcebergPartsFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + filterLimit: filterLimit + }; + } + + static getBlockLength(): number { + return IcebergPartsFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return IcebergPartsFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return IcebergPartsFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return IcebergPartsFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/KlinesResponse.ts b/binance/generated-typescript/spot_sbe/KlinesResponse.ts new file mode 100644 index 0000000000..9ec52b2dac --- /dev/null +++ b/binance/generated-typescript/spot_sbe/KlinesResponse.ts @@ -0,0 +1,143 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Klines { + openTime: bigint; + openPrice: bigint; + highPrice: bigint; + lowPrice: bigint; + closePrice: bigint; + volume: number; + closeTime: bigint; + quoteVolume: number; + numTrades: bigint; + takerBuyBaseVolume: number; + takerBuyQuoteVolume: number; +} + +export interface KlinesResponse { + priceExponent: number; + qtyExponent: number; + klines: Klines[]; +} + +export class KlinesResponseDecoder { + private static readonly BLOCK_LENGTH = 2; + private static readonly TEMPLATE_ID = 203; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): KlinesResponse { + const view = new DataView(buffer); + let pos = offset; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + // Skip to end of block for forward compatibility + pos = offset + KlinesResponseDecoder.BLOCK_LENGTH; + + const klines = this.decodeKlinesGroup(view, pos); + pos = klines.nextOffset; + + return { + priceExponent: priceExponent, + qtyExponent: qtyExponent, + klines: klines.items + }; + } + private decodeKlinesGroup(view: DataView, offset: number): { items: Klines[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Klines[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const openTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const openPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const highPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lowPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const closePrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const volume = view.getUint8(pos); + pos += 16; + + const closeTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const quoteVolume = view.getUint8(pos); + pos += 16; + + const numTrades = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const takerBuyBaseVolume = view.getUint8(pos); + pos += 16; + + const takerBuyQuoteVolume = view.getUint8(pos); + pos += 16; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + openTime: openTime, + openPrice: openPrice, + highPrice: highPrice, + lowPrice: lowPrice, + closePrice: closePrice, + volume: volume, + closeTime: closeTime, + quoteVolume: quoteVolume, + numTrades: numTrades, + takerBuyBaseVolume: takerBuyBaseVolume, + takerBuyQuoteVolume: takerBuyQuoteVolume + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return KlinesResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return KlinesResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return KlinesResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return KlinesResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/ListOrderStatus.ts b/binance/generated-typescript/spot_sbe/ListOrderStatus.ts new file mode 100644 index 0000000000..b94e2dffd7 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ListOrderStatus.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum ListOrderStatus { + Canceling = 0, + Executing = 1, + AllDone = 2, + Reject = 3, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/ListStatusEvent.ts b/binance/generated-typescript/spot_sbe/ListStatusEvent.ts new file mode 100644 index 0000000000..61fee4e652 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ListStatusEvent.ts @@ -0,0 +1,145 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Orders { + orderId: bigint; +} + +export interface ListStatusEvent { + eventTime: bigint; + transactTime: bigint; + orderListId: bigint; + contingencyType: number; + listStatusType: number; + listOrderStatus: number; + subscriptionId: number; + orders: Orders[]; + symbol: Uint8Array; + listClientOrderId: Uint8Array; + rejectReason: Uint8Array; +} + +export class ListStatusEventDecoder { + private static readonly BLOCK_LENGTH = 29; + private static readonly TEMPLATE_ID = 606; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): ListStatusEvent { + const view = new DataView(buffer); + let pos = offset; + + const eventTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const transactTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const contingencyType = view.getUint8(pos); + pos += 1; + + const listStatusType = view.getUint8(pos); + pos += 1; + + const listOrderStatus = view.getUint8(pos); + pos += 1; + + const subscriptionId = view.getUint16(pos, this.littleEndian); + pos += 2; + + // Skip to end of block for forward compatibility + pos = offset + ListStatusEventDecoder.BLOCK_LENGTH; + + const orders = this.decodeOrdersGroup(view, pos); + pos = orders.nextOffset; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + const listClientOrderId = this.decodeVarData(view, pos); + pos = listClientOrderId.nextOffset; + + const rejectReason = this.decodeVarData(view, pos); + pos = rejectReason.nextOffset; + + return { + eventTime: eventTime, + transactTime: transactTime, + orderListId: orderListId, + contingencyType: contingencyType, + listStatusType: listStatusType, + listOrderStatus: listOrderStatus, + subscriptionId: subscriptionId, + orders: orders.items, + symbol: symbol.value, + listClientOrderId: listClientOrderId.value, + rejectReason: rejectReason.value + }; + } + private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: Orders[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderId: orderId + }); + } + + return { items, nextOffset: pos }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return ListStatusEventDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return ListStatusEventDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return ListStatusEventDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return ListStatusEventDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/ListStatusType.ts b/binance/generated-typescript/spot_sbe/ListStatusType.ts new file mode 100644 index 0000000000..4ecabc12fe --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ListStatusType.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum ListStatusType { + Response = 0, + ExecStarted = 1, + AllDone = 2, + Updated = 3, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/LotSizeFilter.ts b/binance/generated-typescript/spot_sbe/LotSizeFilter.ts new file mode 100644 index 0000000000..241386f3fc --- /dev/null +++ b/binance/generated-typescript/spot_sbe/LotSizeFilter.ts @@ -0,0 +1,73 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface LotSizeFilter { + filterType: number; + qtyExponent: number; + minQty: bigint; + maxQty: bigint; + stepSize: bigint; +} + +export class LotSizeFilterDecoder { + private static readonly BLOCK_LENGTH = 25; + private static readonly TEMPLATE_ID = 4; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): LotSizeFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const minQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const maxQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const stepSize = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + LotSizeFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + qtyExponent: qtyExponent, + minQty: minQty, + maxQty: maxQty, + stepSize: stepSize + }; + } + + static getBlockLength(): number { + return LotSizeFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return LotSizeFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return LotSizeFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return LotSizeFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/MarketLotSizeFilter.ts b/binance/generated-typescript/spot_sbe/MarketLotSizeFilter.ts new file mode 100644 index 0000000000..a81a9a3fc5 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MarketLotSizeFilter.ts @@ -0,0 +1,73 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface MarketLotSizeFilter { + filterType: number; + qtyExponent: number; + minQty: bigint; + maxQty: bigint; + stepSize: bigint; +} + +export class MarketLotSizeFilterDecoder { + private static readonly BLOCK_LENGTH = 25; + private static readonly TEMPLATE_ID = 8; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): MarketLotSizeFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const minQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const maxQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const stepSize = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + MarketLotSizeFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + qtyExponent: qtyExponent, + minQty: minQty, + maxQty: maxQty, + stepSize: stepSize + }; + } + + static getBlockLength(): number { + return MarketLotSizeFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return MarketLotSizeFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return MarketLotSizeFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return MarketLotSizeFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/MatchType.ts b/binance/generated-typescript/spot_sbe/MatchType.ts new file mode 100644 index 0000000000..f4c2b3c106 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MatchType.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum MatchType { + AutoMatch = 1, + OnePartyTradeReport = 2, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/MaxAssetFilter.ts b/binance/generated-typescript/spot_sbe/MaxAssetFilter.ts new file mode 100644 index 0000000000..d863d5c39e --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MaxAssetFilter.ts @@ -0,0 +1,80 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface MaxAssetFilter { + filterType: number; + qtyExponent: number; + maxQty: bigint; + asset: Uint8Array; +} + +export class MaxAssetFilterDecoder { + private static readonly BLOCK_LENGTH = 9; + private static readonly TEMPLATE_ID = 21; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): MaxAssetFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const maxQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + MaxAssetFilterDecoder.BLOCK_LENGTH; + + const asset = this.decodeVarData(view, pos); + pos = asset.nextOffset; + + return { + filterType: filterType, + qtyExponent: qtyExponent, + maxQty: maxQty, + asset: asset.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return MaxAssetFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return MaxAssetFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return MaxAssetFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return MaxAssetFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/MaxNumAlgoOrdersFilter.ts b/binance/generated-typescript/spot_sbe/MaxNumAlgoOrdersFilter.ts new file mode 100644 index 0000000000..a3ab3d82f9 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MaxNumAlgoOrdersFilter.ts @@ -0,0 +1,58 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface MaxNumAlgoOrdersFilter { + filterType: number; + maxNumAlgoOrders: bigint; +} + +export class MaxNumAlgoOrdersFilterDecoder { + private static readonly BLOCK_LENGTH = 8; + private static readonly TEMPLATE_ID = 10; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): MaxNumAlgoOrdersFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const maxNumAlgoOrders = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + MaxNumAlgoOrdersFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + maxNumAlgoOrders: maxNumAlgoOrders + }; + } + + static getBlockLength(): number { + return MaxNumAlgoOrdersFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return MaxNumAlgoOrdersFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return MaxNumAlgoOrdersFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return MaxNumAlgoOrdersFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/MaxNumIcebergOrdersFilter.ts b/binance/generated-typescript/spot_sbe/MaxNumIcebergOrdersFilter.ts new file mode 100644 index 0000000000..abf8b64144 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MaxNumIcebergOrdersFilter.ts @@ -0,0 +1,58 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface MaxNumIcebergOrdersFilter { + filterType: number; + maxNumIcebergOrders: bigint; +} + +export class MaxNumIcebergOrdersFilterDecoder { + private static readonly BLOCK_LENGTH = 8; + private static readonly TEMPLATE_ID = 11; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): MaxNumIcebergOrdersFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const maxNumIcebergOrders = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + MaxNumIcebergOrdersFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + maxNumIcebergOrders: maxNumIcebergOrders + }; + } + + static getBlockLength(): number { + return MaxNumIcebergOrdersFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return MaxNumIcebergOrdersFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return MaxNumIcebergOrdersFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return MaxNumIcebergOrdersFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/MaxNumOrderAmendsFilter.ts b/binance/generated-typescript/spot_sbe/MaxNumOrderAmendsFilter.ts new file mode 100644 index 0000000000..dfef6497b4 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MaxNumOrderAmendsFilter.ts @@ -0,0 +1,58 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface MaxNumOrderAmendsFilter { + filterType: number; + maxNumOrderAmends: bigint; +} + +export class MaxNumOrderAmendsFilterDecoder { + private static readonly BLOCK_LENGTH = 8; + private static readonly TEMPLATE_ID = 20; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): MaxNumOrderAmendsFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const maxNumOrderAmends = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + MaxNumOrderAmendsFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + maxNumOrderAmends: maxNumOrderAmends + }; + } + + static getBlockLength(): number { + return MaxNumOrderAmendsFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return MaxNumOrderAmendsFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return MaxNumOrderAmendsFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return MaxNumOrderAmendsFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/MaxNumOrderListsFilter.ts b/binance/generated-typescript/spot_sbe/MaxNumOrderListsFilter.ts new file mode 100644 index 0000000000..3b700bc33b --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MaxNumOrderListsFilter.ts @@ -0,0 +1,58 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface MaxNumOrderListsFilter { + filterType: number; + maxNumOrderLists: bigint; +} + +export class MaxNumOrderListsFilterDecoder { + private static readonly BLOCK_LENGTH = 8; + private static readonly TEMPLATE_ID = 18; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): MaxNumOrderListsFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const maxNumOrderLists = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + MaxNumOrderListsFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + maxNumOrderLists: maxNumOrderLists + }; + } + + static getBlockLength(): number { + return MaxNumOrderListsFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return MaxNumOrderListsFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return MaxNumOrderListsFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return MaxNumOrderListsFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/MaxNumOrdersFilter.ts b/binance/generated-typescript/spot_sbe/MaxNumOrdersFilter.ts new file mode 100644 index 0000000000..dfa7a2ef77 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MaxNumOrdersFilter.ts @@ -0,0 +1,58 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface MaxNumOrdersFilter { + filterType: number; + maxNumOrders: bigint; +} + +export class MaxNumOrdersFilterDecoder { + private static readonly BLOCK_LENGTH = 8; + private static readonly TEMPLATE_ID = 9; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): MaxNumOrdersFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const maxNumOrders = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + MaxNumOrdersFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + maxNumOrders: maxNumOrders + }; + } + + static getBlockLength(): number { + return MaxNumOrdersFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return MaxNumOrdersFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return MaxNumOrdersFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return MaxNumOrdersFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/MaxPositionFilter.ts b/binance/generated-typescript/spot_sbe/MaxPositionFilter.ts new file mode 100644 index 0000000000..fbf1e8af59 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MaxPositionFilter.ts @@ -0,0 +1,63 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface MaxPositionFilter { + filterType: number; + qtyExponent: number; + maxPosition: bigint; +} + +export class MaxPositionFilterDecoder { + private static readonly BLOCK_LENGTH = 9; + private static readonly TEMPLATE_ID = 12; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): MaxPositionFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const maxPosition = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + MaxPositionFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + qtyExponent: qtyExponent, + maxPosition: maxPosition + }; + } + + static getBlockLength(): number { + return MaxPositionFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return MaxPositionFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return MaxPositionFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return MaxPositionFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/MessageData.ts b/binance/generated-typescript/spot_sbe/MessageData.ts new file mode 100644 index 0000000000..4e78f68c34 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MessageData.ts @@ -0,0 +1,33 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface MessageData { + length: number; + varData: number; +} + +export class MessageDataDecoder { + private static readonly ENCODED_LENGTH = -1; + + static decode(view: DataView, offset: number, littleEndian: boolean): MessageData { + let pos = offset; + + const length = view.getUint32(pos, littleEndian); + pos += 4; + + const varData = view.getUint8(pos); + pos += -1; + + return { + length: length, + varData: varData + }; + } + + static getEncodedLength(): number { + return MessageDataDecoder.ENCODED_LENGTH; + } +} diff --git a/binance/generated-typescript/spot_sbe/MessageData16.ts b/binance/generated-typescript/spot_sbe/MessageData16.ts new file mode 100644 index 0000000000..96af57664f --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MessageData16.ts @@ -0,0 +1,33 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface MessageData16 { + length: number; + varData: number; +} + +export class MessageData16Decoder { + private static readonly ENCODED_LENGTH = -1; + + static decode(view: DataView, offset: number, littleEndian: boolean): MessageData16 { + let pos = offset; + + const length = view.getUint16(pos, littleEndian); + pos += 2; + + const varData = view.getUint8(pos); + pos += -1; + + return { + length: length, + varData: varData + }; + } + + static getEncodedLength(): number { + return MessageData16Decoder.ENCODED_LENGTH; + } +} diff --git a/binance/generated-typescript/spot_sbe/MessageData8.ts b/binance/generated-typescript/spot_sbe/MessageData8.ts new file mode 100644 index 0000000000..56430b228d --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MessageData8.ts @@ -0,0 +1,33 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface MessageData8 { + length: number; + varData: number; +} + +export class MessageData8Decoder { + private static readonly ENCODED_LENGTH = -1; + + static decode(view: DataView, offset: number, littleEndian: boolean): MessageData8 { + let pos = offset; + + const length = view.getUint8(pos); + pos += 1; + + const varData = view.getUint8(pos); + pos += -1; + + return { + length: length, + varData: varData + }; + } + + static getEncodedLength(): number { + return MessageData8Decoder.ENCODED_LENGTH; + } +} diff --git a/binance/generated-typescript/spot_sbe/MessageHeader.ts b/binance/generated-typescript/spot_sbe/MessageHeader.ts new file mode 100644 index 0000000000..ed1013fc57 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MessageHeader.ts @@ -0,0 +1,43 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface MessageHeader { + blockLength: number; + templateId: number; + schemaId: number; + version: number; +} + +export class MessageHeaderDecoder { + private static readonly ENCODED_LENGTH = 8; + + static decode(view: DataView, offset: number, littleEndian: boolean): MessageHeader { + let pos = offset; + + const blockLength = view.getUint16(pos, littleEndian); + pos += 2; + + const templateId = view.getUint16(pos, littleEndian); + pos += 2; + + const schemaId = view.getUint16(pos, littleEndian); + pos += 2; + + const version = view.getUint16(pos, littleEndian); + pos += 2; + + return { + blockLength: blockLength, + templateId: templateId, + schemaId: schemaId, + version: version + }; + } + + static getEncodedLength(): number { + return MessageHeaderDecoder.ENCODED_LENGTH; + } +} diff --git a/binance/generated-typescript/spot_sbe/MinNotionalFilter.ts b/binance/generated-typescript/spot_sbe/MinNotionalFilter.ts new file mode 100644 index 0000000000..17315a9b83 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MinNotionalFilter.ts @@ -0,0 +1,73 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface MinNotionalFilter { + filterType: number; + priceExponent: number; + minNotional: bigint; + applyToMarket: number; + avgPriceMins: number; +} + +export class MinNotionalFilterDecoder { + private static readonly BLOCK_LENGTH = 14; + private static readonly TEMPLATE_ID = 5; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): MinNotionalFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const minNotional = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const applyToMarket = view.getUint8(pos); + pos += 1; + + const avgPriceMins = view.getInt32(pos, this.littleEndian); + pos += 4; + + // Skip to end of block for forward compatibility + pos = offset + MinNotionalFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + priceExponent: priceExponent, + minNotional: minNotional, + applyToMarket: applyToMarket, + avgPriceMins: avgPriceMins + }; + } + + static getBlockLength(): number { + return MinNotionalFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return MinNotionalFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return MinNotionalFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return MinNotionalFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/MyFiltersResponse.ts b/binance/generated-typescript/spot_sbe/MyFiltersResponse.ts new file mode 100644 index 0000000000..86e0f02621 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/MyFiltersResponse.ts @@ -0,0 +1,138 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface ExchangeFilters { +} + +export interface SymbolFilters { +} + +export interface AssetFilters { +} + +export interface MyFiltersResponse { + exchangeFilters: ExchangeFilters[]; + symbolFilters: SymbolFilters[]; + assetFilters: AssetFilters[]; +} + +export class MyFiltersResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 105; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): MyFiltersResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + MyFiltersResponseDecoder.BLOCK_LENGTH; + + const exchangeFilters = this.decodeExchangeFiltersGroup(view, pos); + pos = exchangeFilters.nextOffset; + + const symbolFilters = this.decodeSymbolFiltersGroup(view, pos); + pos = symbolFilters.nextOffset; + + const assetFilters = this.decodeAssetFiltersGroup(view, pos); + pos = assetFilters.nextOffset; + + return { + exchangeFilters: exchangeFilters.items, + symbolFilters: symbolFilters.items, + assetFilters: assetFilters.items + }; + } + private decodeExchangeFiltersGroup(view: DataView, offset: number): { items: ExchangeFilters[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: ExchangeFilters[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + }); + } + + return { items, nextOffset: pos }; + } + private decodeSymbolFiltersGroup(view: DataView, offset: number): { items: SymbolFilters[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: SymbolFilters[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + }); + } + + return { items, nextOffset: pos }; + } + private decodeAssetFiltersGroup(view: DataView, offset: number): { items: AssetFilters[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: AssetFilters[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return MyFiltersResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return MyFiltersResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return MyFiltersResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return MyFiltersResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/NewOrderAckResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderAckResponse.ts new file mode 100644 index 0000000000..664f55271f --- /dev/null +++ b/binance/generated-typescript/spot_sbe/NewOrderAckResponse.ts @@ -0,0 +1,85 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface NewOrderAckResponse { + orderId: bigint; + orderListId: bigint; + transactTime: bigint; + symbol: Uint8Array; + clientOrderId: Uint8Array; +} + +export class NewOrderAckResponseDecoder { + private static readonly BLOCK_LENGTH = 24; + private static readonly TEMPLATE_ID = 300; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): NewOrderAckResponse { + const view = new DataView(buffer); + let pos = offset; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const transactTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + NewOrderAckResponseDecoder.BLOCK_LENGTH; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + const clientOrderId = this.decodeVarData(view, pos); + pos = clientOrderId.nextOffset; + + return { + orderId: orderId, + orderListId: orderListId, + transactTime: transactTime, + symbol: symbol.value, + clientOrderId: clientOrderId.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return NewOrderAckResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return NewOrderAckResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return NewOrderAckResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return NewOrderAckResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/NewOrderFullResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderFullResponse.ts new file mode 100644 index 0000000000..1aa1c61df4 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/NewOrderFullResponse.ts @@ -0,0 +1,345 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Fills { + commissionExponent: number; + matchType: number; + price: bigint; + qty: bigint; + commission: bigint; + tradeId: bigint; + allocId: bigint; +} + +export interface PreventedMatches { + preventedMatchId: bigint; + makerOrderId: bigint; + price: bigint; + takerPreventedQuantity: bigint; + makerPreventedQuantity: bigint; +} + +export interface NewOrderFullResponse { + priceExponent: number; + qtyExponent: number; + orderId: bigint; + orderListId: bigint; + transactTime: bigint; + price: bigint; + origQty: bigint; + executedQty: bigint; + cummulativeQuoteQty: bigint; + status: number; + timeInForce: number; + orderType: number; + side: number; + stopPrice: bigint; + trailingDelta: bigint; + trailingTime: bigint; + workingTime: bigint; + icebergQty: bigint; + strategyId: bigint; + strategyType: number; + orderCapacity: number; + workingFloor: number; + selfTradePreventionMode: number; + tradeGroupId: bigint; + preventedQuantity: bigint; + usedSor: number; + origQuoteOrderQty: bigint; + pegPriceType: number; + pegOffsetType: number; + pegOffsetValue: number; + peggedPrice: bigint; + fills: Fills[]; + preventedMatches: PreventedMatches[]; + symbol: Uint8Array; + clientOrderId: Uint8Array; +} + +export class NewOrderFullResponseDecoder { + private static readonly BLOCK_LENGTH = 153; + private static readonly TEMPLATE_ID = 302; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): NewOrderFullResponse { + const view = new DataView(buffer); + let pos = offset; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const transactTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const origQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const status = view.getUint8(pos); + pos += 1; + + const timeInForce = view.getUint8(pos); + pos += 1; + + const orderType = view.getUint8(pos); + pos += 1; + + const side = view.getUint8(pos); + pos += 1; + + const stopPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const workingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const icebergQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyType = view.getInt32(pos, this.littleEndian); + pos += 4; + + const orderCapacity = view.getUint8(pos); + pos += 1; + + const workingFloor = view.getUint8(pos); + pos += 1; + + const selfTradePreventionMode = view.getUint8(pos); + pos += 1; + + const tradeGroupId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const usedSor = view.getUint8(pos); + pos += 1; + + const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const pegPriceType = view.getUint8(pos); + pos += 1; + + const pegOffsetType = view.getUint8(pos); + pos += 1; + + const pegOffsetValue = view.getUint8(pos); + pos += 1; + + const peggedPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + NewOrderFullResponseDecoder.BLOCK_LENGTH; + + const fills = this.decodeFillsGroup(view, pos); + pos = fills.nextOffset; + + const preventedMatches = this.decodePreventedMatchesGroup(view, pos); + pos = preventedMatches.nextOffset; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + const clientOrderId = this.decodeVarData(view, pos); + pos = clientOrderId.nextOffset; + + return { + priceExponent: priceExponent, + qtyExponent: qtyExponent, + orderId: orderId, + orderListId: orderListId, + transactTime: transactTime, + price: price, + origQty: origQty, + executedQty: executedQty, + cummulativeQuoteQty: cummulativeQuoteQty, + status: status, + timeInForce: timeInForce, + orderType: orderType, + side: side, + stopPrice: stopPrice, + trailingDelta: trailingDelta, + trailingTime: trailingTime, + workingTime: workingTime, + icebergQty: icebergQty, + strategyId: strategyId, + strategyType: strategyType, + orderCapacity: orderCapacity, + workingFloor: workingFloor, + selfTradePreventionMode: selfTradePreventionMode, + tradeGroupId: tradeGroupId, + preventedQuantity: preventedQuantity, + usedSor: usedSor, + origQuoteOrderQty: origQuoteOrderQty, + pegPriceType: pegPriceType, + pegOffsetType: pegOffsetType, + pegOffsetValue: pegOffsetValue, + peggedPrice: peggedPrice, + fills: fills.items, + preventedMatches: preventedMatches.items, + symbol: symbol.value, + clientOrderId: clientOrderId.value + }; + } + private decodeFillsGroup(view: DataView, offset: number): { items: Fills[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Fills[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const commissionExponent = view.getInt8(pos); + pos += 1; + + const matchType = view.getUint8(pos); + pos += 1; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const commission = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const tradeId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const allocId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + commissionExponent: commissionExponent, + matchType: matchType, + price: price, + qty: qty, + commission: commission, + tradeId: tradeId, + allocId: allocId + }); + } + + return { items, nextOffset: pos }; + } + private decodePreventedMatchesGroup(view: DataView, offset: number): { items: PreventedMatches[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: PreventedMatches[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const preventedMatchId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const makerOrderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const takerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const makerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + preventedMatchId: preventedMatchId, + makerOrderId: makerOrderId, + price: price, + takerPreventedQuantity: takerPreventedQuantity, + makerPreventedQuantity: makerPreventedQuantity + }); + } + + return { items, nextOffset: pos }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return NewOrderFullResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return NewOrderFullResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return NewOrderFullResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return NewOrderFullResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/NewOrderListAckResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderListAckResponse.ts new file mode 100644 index 0000000000..66d1454b3f --- /dev/null +++ b/binance/generated-typescript/spot_sbe/NewOrderListAckResponse.ts @@ -0,0 +1,175 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Orders { + orderId: bigint; +} + +export interface OrderReports { + orderId: bigint; + orderListId: bigint; + transactTime: bigint; +} + +export interface NewOrderListAckResponse { + orderListId: bigint; + contingencyType: number; + listStatusType: number; + listOrderStatus: number; + transactionTime: bigint; + orders: Orders[]; + orderReports: OrderReports[]; + listClientOrderId: Uint8Array; + symbol: Uint8Array; +} + +export class NewOrderListAckResponseDecoder { + private static readonly BLOCK_LENGTH = 19; + private static readonly TEMPLATE_ID = 309; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): NewOrderListAckResponse { + const view = new DataView(buffer); + let pos = offset; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const contingencyType = view.getUint8(pos); + pos += 1; + + const listStatusType = view.getUint8(pos); + pos += 1; + + const listOrderStatus = view.getUint8(pos); + pos += 1; + + const transactionTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + NewOrderListAckResponseDecoder.BLOCK_LENGTH; + + const orders = this.decodeOrdersGroup(view, pos); + pos = orders.nextOffset; + + const orderReports = this.decodeOrderReportsGroup(view, pos); + pos = orderReports.nextOffset; + + const listClientOrderId = this.decodeVarData(view, pos); + pos = listClientOrderId.nextOffset; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + return { + orderListId: orderListId, + contingencyType: contingencyType, + listStatusType: listStatusType, + listOrderStatus: listOrderStatus, + transactionTime: transactionTime, + orders: orders.items, + orderReports: orderReports.items, + listClientOrderId: listClientOrderId.value, + symbol: symbol.value + }; + } + private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: Orders[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderId: orderId + }); + } + + return { items, nextOffset: pos }; + } + private decodeOrderReportsGroup(view: DataView, offset: number): { items: OrderReports[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: OrderReports[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const transactTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderId: orderId, + orderListId: orderListId, + transactTime: transactTime + }); + } + + return { items, nextOffset: pos }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return NewOrderListAckResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return NewOrderListAckResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return NewOrderListAckResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return NewOrderListAckResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/NewOrderListFullResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderListFullResponse.ts new file mode 100644 index 0000000000..6fc493e340 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/NewOrderListFullResponse.ts @@ -0,0 +1,369 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Orders { + orderId: bigint; +} + +export interface OrderReports { + orderId: bigint; + orderListId: bigint; + transactTime: bigint; + price: bigint; + origQty: bigint; + executedQty: bigint; + cummulativeQuoteQty: bigint; + status: number; + timeInForce: number; + orderType: number; + side: number; + stopPrice: bigint; + trailingDelta: bigint; + trailingTime: bigint; + workingTime: bigint; + icebergQty: bigint; + strategyId: bigint; + strategyType: number; + orderCapacity: number; + workingFloor: number; + selfTradePreventionMode: number; + tradeGroupId: bigint; + preventedQuantity: bigint; + usedSor: number; + origQuoteOrderQty: bigint; + pegPriceType: number; + pegOffsetType: number; + pegOffsetValue: number; + peggedPrice: bigint; + commissionExponent: number; + matchType: number; + qty: bigint; + commission: bigint; + tradeId: bigint; + allocId: bigint; + preventedMatchId: bigint; + makerOrderId: bigint; + takerPreventedQuantity: bigint; + makerPreventedQuantity: bigint; +} + +export interface NewOrderListFullResponse { + orderListId: bigint; + contingencyType: number; + listStatusType: number; + listOrderStatus: number; + transactionTime: bigint; + priceExponent: number; + qtyExponent: number; + orders: Orders[]; + orderReports: OrderReports[]; + listClientOrderId: Uint8Array; + symbol: Uint8Array; +} + +export class NewOrderListFullResponseDecoder { + private static readonly BLOCK_LENGTH = 21; + private static readonly TEMPLATE_ID = 311; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): NewOrderListFullResponse { + const view = new DataView(buffer); + let pos = offset; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const contingencyType = view.getUint8(pos); + pos += 1; + + const listStatusType = view.getUint8(pos); + pos += 1; + + const listOrderStatus = view.getUint8(pos); + pos += 1; + + const transactionTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + // Skip to end of block for forward compatibility + pos = offset + NewOrderListFullResponseDecoder.BLOCK_LENGTH; + + const orders = this.decodeOrdersGroup(view, pos); + pos = orders.nextOffset; + + const orderReports = this.decodeOrderReportsGroup(view, pos); + pos = orderReports.nextOffset; + + const listClientOrderId = this.decodeVarData(view, pos); + pos = listClientOrderId.nextOffset; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + return { + orderListId: orderListId, + contingencyType: contingencyType, + listStatusType: listStatusType, + listOrderStatus: listOrderStatus, + transactionTime: transactionTime, + priceExponent: priceExponent, + qtyExponent: qtyExponent, + orders: orders.items, + orderReports: orderReports.items, + listClientOrderId: listClientOrderId.value, + symbol: symbol.value + }; + } + private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: Orders[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderId: orderId + }); + } + + return { items, nextOffset: pos }; + } + private decodeOrderReportsGroup(view: DataView, offset: number): { items: OrderReports[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: OrderReports[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const transactTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const origQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const status = view.getUint8(pos); + pos += 1; + + const timeInForce = view.getUint8(pos); + pos += 1; + + const orderType = view.getUint8(pos); + pos += 1; + + const side = view.getUint8(pos); + pos += 1; + + const stopPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const workingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const icebergQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyType = view.getInt32(pos, this.littleEndian); + pos += 4; + + const orderCapacity = view.getUint8(pos); + pos += 1; + + const workingFloor = view.getUint8(pos); + pos += 1; + + const selfTradePreventionMode = view.getUint8(pos); + pos += 1; + + const tradeGroupId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const usedSor = view.getUint8(pos); + pos += 1; + + const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const pegPriceType = view.getUint8(pos); + pos += 1; + + const pegOffsetType = view.getUint8(pos); + pos += 1; + + const pegOffsetValue = view.getUint8(pos); + pos += 1; + + const peggedPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const commissionExponent = view.getInt8(pos); + pos += 1; + + const matchType = view.getUint8(pos); + pos += 1; + + pos += 8; + + const qty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const commission = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const tradeId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const allocId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedMatchId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const makerOrderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + pos += 8; + + const takerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const makerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderId: orderId, + orderListId: orderListId, + transactTime: transactTime, + price: price, + origQty: origQty, + executedQty: executedQty, + cummulativeQuoteQty: cummulativeQuoteQty, + status: status, + timeInForce: timeInForce, + orderType: orderType, + side: side, + stopPrice: stopPrice, + trailingDelta: trailingDelta, + trailingTime: trailingTime, + workingTime: workingTime, + icebergQty: icebergQty, + strategyId: strategyId, + strategyType: strategyType, + orderCapacity: orderCapacity, + workingFloor: workingFloor, + selfTradePreventionMode: selfTradePreventionMode, + tradeGroupId: tradeGroupId, + preventedQuantity: preventedQuantity, + usedSor: usedSor, + origQuoteOrderQty: origQuoteOrderQty, + pegPriceType: pegPriceType, + pegOffsetType: pegOffsetType, + pegOffsetValue: pegOffsetValue, + peggedPrice: peggedPrice, + commissionExponent: commissionExponent, + matchType: matchType, + qty: qty, + commission: commission, + tradeId: tradeId, + allocId: allocId, + preventedMatchId: preventedMatchId, + makerOrderId: makerOrderId, + takerPreventedQuantity: takerPreventedQuantity, + makerPreventedQuantity: makerPreventedQuantity + }); + } + + return { items, nextOffset: pos }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return NewOrderListFullResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return NewOrderListFullResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return NewOrderListFullResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return NewOrderListFullResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/NewOrderListResultResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderListResultResponse.ts new file mode 100644 index 0000000000..c8a790c781 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/NewOrderListResultResponse.ts @@ -0,0 +1,315 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Orders { + orderId: bigint; +} + +export interface OrderReports { + orderId: bigint; + orderListId: bigint; + transactTime: bigint; + price: bigint; + origQty: bigint; + executedQty: bigint; + cummulativeQuoteQty: bigint; + status: number; + timeInForce: number; + orderType: number; + side: number; + stopPrice: bigint; + trailingDelta: bigint; + trailingTime: bigint; + workingTime: bigint; + icebergQty: bigint; + strategyId: bigint; + strategyType: number; + orderCapacity: number; + workingFloor: number; + selfTradePreventionMode: number; + tradeGroupId: bigint; + preventedQuantity: bigint; + usedSor: number; + origQuoteOrderQty: bigint; + pegPriceType: number; + pegOffsetType: number; + pegOffsetValue: number; + peggedPrice: bigint; +} + +export interface NewOrderListResultResponse { + orderListId: bigint; + contingencyType: number; + listStatusType: number; + listOrderStatus: number; + transactionTime: bigint; + priceExponent: number; + qtyExponent: number; + orders: Orders[]; + orderReports: OrderReports[]; + listClientOrderId: Uint8Array; + symbol: Uint8Array; +} + +export class NewOrderListResultResponseDecoder { + private static readonly BLOCK_LENGTH = 21; + private static readonly TEMPLATE_ID = 310; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): NewOrderListResultResponse { + const view = new DataView(buffer); + let pos = offset; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const contingencyType = view.getUint8(pos); + pos += 1; + + const listStatusType = view.getUint8(pos); + pos += 1; + + const listOrderStatus = view.getUint8(pos); + pos += 1; + + const transactionTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + // Skip to end of block for forward compatibility + pos = offset + NewOrderListResultResponseDecoder.BLOCK_LENGTH; + + const orders = this.decodeOrdersGroup(view, pos); + pos = orders.nextOffset; + + const orderReports = this.decodeOrderReportsGroup(view, pos); + pos = orderReports.nextOffset; + + const listClientOrderId = this.decodeVarData(view, pos); + pos = listClientOrderId.nextOffset; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + return { + orderListId: orderListId, + contingencyType: contingencyType, + listStatusType: listStatusType, + listOrderStatus: listOrderStatus, + transactionTime: transactionTime, + priceExponent: priceExponent, + qtyExponent: qtyExponent, + orders: orders.items, + orderReports: orderReports.items, + listClientOrderId: listClientOrderId.value, + symbol: symbol.value + }; + } + private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: Orders[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderId: orderId + }); + } + + return { items, nextOffset: pos }; + } + private decodeOrderReportsGroup(view: DataView, offset: number): { items: OrderReports[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: OrderReports[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const transactTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const origQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const status = view.getUint8(pos); + pos += 1; + + const timeInForce = view.getUint8(pos); + pos += 1; + + const orderType = view.getUint8(pos); + pos += 1; + + const side = view.getUint8(pos); + pos += 1; + + const stopPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const workingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const icebergQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyType = view.getInt32(pos, this.littleEndian); + pos += 4; + + const orderCapacity = view.getUint8(pos); + pos += 1; + + const workingFloor = view.getUint8(pos); + pos += 1; + + const selfTradePreventionMode = view.getUint8(pos); + pos += 1; + + const tradeGroupId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const usedSor = view.getUint8(pos); + pos += 1; + + const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const pegPriceType = view.getUint8(pos); + pos += 1; + + const pegOffsetType = view.getUint8(pos); + pos += 1; + + const pegOffsetValue = view.getUint8(pos); + pos += 1; + + const peggedPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderId: orderId, + orderListId: orderListId, + transactTime: transactTime, + price: price, + origQty: origQty, + executedQty: executedQty, + cummulativeQuoteQty: cummulativeQuoteQty, + status: status, + timeInForce: timeInForce, + orderType: orderType, + side: side, + stopPrice: stopPrice, + trailingDelta: trailingDelta, + trailingTime: trailingTime, + workingTime: workingTime, + icebergQty: icebergQty, + strategyId: strategyId, + strategyType: strategyType, + orderCapacity: orderCapacity, + workingFloor: workingFloor, + selfTradePreventionMode: selfTradePreventionMode, + tradeGroupId: tradeGroupId, + preventedQuantity: preventedQuantity, + usedSor: usedSor, + origQuoteOrderQty: origQuoteOrderQty, + pegPriceType: pegPriceType, + pegOffsetType: pegOffsetType, + pegOffsetValue: pegOffsetValue, + peggedPrice: peggedPrice + }); + } + + return { items, nextOffset: pos }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return NewOrderListResultResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return NewOrderListResultResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return NewOrderListResultResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return NewOrderListResultResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/NewOrderResultResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderResultResponse.ts new file mode 100644 index 0000000000..ab6a286088 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/NewOrderResultResponse.ts @@ -0,0 +1,225 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface NewOrderResultResponse { + priceExponent: number; + qtyExponent: number; + orderId: bigint; + orderListId: bigint; + transactTime: bigint; + price: bigint; + origQty: bigint; + executedQty: bigint; + cummulativeQuoteQty: bigint; + status: number; + timeInForce: number; + orderType: number; + side: number; + stopPrice: bigint; + trailingDelta: bigint; + trailingTime: bigint; + workingTime: bigint; + icebergQty: bigint; + strategyId: bigint; + strategyType: number; + orderCapacity: number; + workingFloor: number; + selfTradePreventionMode: number; + tradeGroupId: bigint; + preventedQuantity: bigint; + usedSor: number; + origQuoteOrderQty: bigint; + pegPriceType: number; + pegOffsetType: number; + pegOffsetValue: number; + peggedPrice: bigint; + symbol: Uint8Array; + clientOrderId: Uint8Array; +} + +export class NewOrderResultResponseDecoder { + private static readonly BLOCK_LENGTH = 153; + private static readonly TEMPLATE_ID = 301; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): NewOrderResultResponse { + const view = new DataView(buffer); + let pos = offset; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const transactTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const origQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const status = view.getUint8(pos); + pos += 1; + + const timeInForce = view.getUint8(pos); + pos += 1; + + const orderType = view.getUint8(pos); + pos += 1; + + const side = view.getUint8(pos); + pos += 1; + + const stopPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const workingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const icebergQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyType = view.getInt32(pos, this.littleEndian); + pos += 4; + + const orderCapacity = view.getUint8(pos); + pos += 1; + + const workingFloor = view.getUint8(pos); + pos += 1; + + const selfTradePreventionMode = view.getUint8(pos); + pos += 1; + + const tradeGroupId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const usedSor = view.getUint8(pos); + pos += 1; + + const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const pegPriceType = view.getUint8(pos); + pos += 1; + + const pegOffsetType = view.getUint8(pos); + pos += 1; + + const pegOffsetValue = view.getUint8(pos); + pos += 1; + + const peggedPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + NewOrderResultResponseDecoder.BLOCK_LENGTH; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + const clientOrderId = this.decodeVarData(view, pos); + pos = clientOrderId.nextOffset; + + return { + priceExponent: priceExponent, + qtyExponent: qtyExponent, + orderId: orderId, + orderListId: orderListId, + transactTime: transactTime, + price: price, + origQty: origQty, + executedQty: executedQty, + cummulativeQuoteQty: cummulativeQuoteQty, + status: status, + timeInForce: timeInForce, + orderType: orderType, + side: side, + stopPrice: stopPrice, + trailingDelta: trailingDelta, + trailingTime: trailingTime, + workingTime: workingTime, + icebergQty: icebergQty, + strategyId: strategyId, + strategyType: strategyType, + orderCapacity: orderCapacity, + workingFloor: workingFloor, + selfTradePreventionMode: selfTradePreventionMode, + tradeGroupId: tradeGroupId, + preventedQuantity: preventedQuantity, + usedSor: usedSor, + origQuoteOrderQty: origQuoteOrderQty, + pegPriceType: pegPriceType, + pegOffsetType: pegOffsetType, + pegOffsetValue: pegOffsetValue, + peggedPrice: peggedPrice, + symbol: symbol.value, + clientOrderId: clientOrderId.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return NewOrderResultResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return NewOrderResultResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return NewOrderResultResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return NewOrderResultResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/NonRepresentableMessage.ts b/binance/generated-typescript/spot_sbe/NonRepresentableMessage.ts new file mode 100644 index 0000000000..2ff12146c0 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/NonRepresentableMessage.ts @@ -0,0 +1,48 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface NonRepresentableMessage { +} + +export class NonRepresentableMessageDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 999; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): NonRepresentableMessage { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + NonRepresentableMessageDecoder.BLOCK_LENGTH; + + return { + }; + } + + static getBlockLength(): number { + return NonRepresentableMessageDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return NonRepresentableMessageDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return NonRepresentableMessageDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return NonRepresentableMessageDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/NotionalFilter.ts b/binance/generated-typescript/spot_sbe/NotionalFilter.ts new file mode 100644 index 0000000000..6fce4ba50a --- /dev/null +++ b/binance/generated-typescript/spot_sbe/NotionalFilter.ts @@ -0,0 +1,83 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface NotionalFilter { + filterType: number; + priceExponent: number; + minNotional: bigint; + applyMinToMarket: number; + maxNotional: bigint; + applyMaxToMarket: number; + avgPriceMins: number; +} + +export class NotionalFilterDecoder { + private static readonly BLOCK_LENGTH = 23; + private static readonly TEMPLATE_ID = 6; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): NotionalFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const minNotional = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const applyMinToMarket = view.getUint8(pos); + pos += 1; + + const maxNotional = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const applyMaxToMarket = view.getUint8(pos); + pos += 1; + + const avgPriceMins = view.getInt32(pos, this.littleEndian); + pos += 4; + + // Skip to end of block for forward compatibility + pos = offset + NotionalFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + priceExponent: priceExponent, + minNotional: minNotional, + applyMinToMarket: applyMinToMarket, + maxNotional: maxNotional, + applyMaxToMarket: applyMaxToMarket, + avgPriceMins: avgPriceMins + }; + } + + static getBlockLength(): number { + return NotionalFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return NotionalFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return NotionalFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return NotionalFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/OptionalMessageData.ts b/binance/generated-typescript/spot_sbe/OptionalMessageData.ts new file mode 100644 index 0000000000..650ec5f86d --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OptionalMessageData.ts @@ -0,0 +1,33 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface OptionalMessageData { + length: number; + varData: number; +} + +export class OptionalMessageDataDecoder { + private static readonly ENCODED_LENGTH = -1; + + static decode(view: DataView, offset: number, littleEndian: boolean): OptionalMessageData { + let pos = offset; + + const length = view.getUint32(pos, littleEndian); + pos += 4; + + const varData = view.getUint8(pos); + pos += -1; + + return { + length: length, + varData: varData + }; + } + + static getEncodedLength(): number { + return OptionalMessageDataDecoder.ENCODED_LENGTH; + } +} diff --git a/binance/generated-typescript/spot_sbe/OptionalMessageData16.ts b/binance/generated-typescript/spot_sbe/OptionalMessageData16.ts new file mode 100644 index 0000000000..4d95470642 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OptionalMessageData16.ts @@ -0,0 +1,33 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface OptionalMessageData16 { + length: number; + varData: number; +} + +export class OptionalMessageData16Decoder { + private static readonly ENCODED_LENGTH = -1; + + static decode(view: DataView, offset: number, littleEndian: boolean): OptionalMessageData16 { + let pos = offset; + + const length = view.getUint16(pos, littleEndian); + pos += 2; + + const varData = view.getUint8(pos); + pos += -1; + + return { + length: length, + varData: varData + }; + } + + static getEncodedLength(): number { + return OptionalMessageData16Decoder.ENCODED_LENGTH; + } +} diff --git a/binance/generated-typescript/spot_sbe/OptionalVarString.ts b/binance/generated-typescript/spot_sbe/OptionalVarString.ts new file mode 100644 index 0000000000..4c74932df6 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OptionalVarString.ts @@ -0,0 +1,33 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface OptionalVarString { + length: number; + varData: number; +} + +export class OptionalVarStringDecoder { + private static readonly ENCODED_LENGTH = -1; + + static decode(view: DataView, offset: number, littleEndian: boolean): OptionalVarString { + let pos = offset; + + const length = view.getUint16(pos, littleEndian); + pos += 2; + + const varData = view.getUint8(pos); + pos += -1; + + return { + length: length, + varData: varData + }; + } + + static getEncodedLength(): number { + return OptionalVarStringDecoder.ENCODED_LENGTH; + } +} diff --git a/binance/generated-typescript/spot_sbe/OptionalVarString8.ts b/binance/generated-typescript/spot_sbe/OptionalVarString8.ts new file mode 100644 index 0000000000..0edbd8091a --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OptionalVarString8.ts @@ -0,0 +1,33 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface OptionalVarString8 { + length: number; + varData: number; +} + +export class OptionalVarString8Decoder { + private static readonly ENCODED_LENGTH = -1; + + static decode(view: DataView, offset: number, littleEndian: boolean): OptionalVarString8 { + let pos = offset; + + const length = view.getUint8(pos); + pos += 1; + + const varData = view.getUint8(pos); + pos += -1; + + return { + length: length, + varData: varData + }; + } + + static getEncodedLength(): number { + return OptionalVarString8Decoder.ENCODED_LENGTH; + } +} diff --git a/binance/generated-typescript/spot_sbe/OrderAmendKeepPriorityResponse.ts b/binance/generated-typescript/spot_sbe/OrderAmendKeepPriorityResponse.ts new file mode 100644 index 0000000000..6dd4750a4e --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OrderAmendKeepPriorityResponse.ts @@ -0,0 +1,435 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface ListStatus { + orderListId: bigint; + contingencyType: number; + listOrderStatus: number; + orderId: bigint; +} + +export interface RelatedOrders { + orderId: bigint; + orderListId: bigint; + price: bigint; + qty: bigint; + executedQty: bigint; + preventedQty: bigint; + cumulativeQuoteQty: bigint; + status: number; + timeInForce: number; + orderType: number; + side: number; + stopPrice: bigint; + trailingDelta: bigint; + trailingTime: bigint; + icebergQty: bigint; + workingTime: bigint; + strategyId: bigint; + strategyType: number; + orderCapacity: number; + workingFloor: number; + selfTradePreventionMode: number; + usedSor: number; + pegPriceType: number; + pegOffsetType: number; + pegOffsetValue: number; + peggedPrice: bigint; +} + +export interface OrderAmendKeepPriorityResponse { + transactTime: bigint; + executionId: bigint; + priceExponent: number; + qtyExponent: number; + orderId: bigint; + orderListId: bigint; + price: bigint; + qty: bigint; + executedQty: bigint; + preventedQty: bigint; + cumulativeQuoteQty: bigint; + status: number; + timeInForce: number; + orderType: number; + side: number; + stopPrice: bigint; + trailingDelta: bigint; + trailingTime: bigint; + icebergQty: bigint; + workingTime: bigint; + strategyId: bigint; + strategyType: number; + orderCapacity: number; + workingFloor: number; + selfTradePreventionMode: number; + usedSor: number; + pegPriceType: number; + pegOffsetType: number; + pegOffsetValue: number; + peggedPrice: bigint; + listStatus: ListStatus[]; + relatedOrders: RelatedOrders[]; + symbol: Uint8Array; + origClientOrderId: Uint8Array; + clientOrderId: Uint8Array; +} + +export class OrderAmendKeepPriorityResponseDecoder { + private static readonly BLOCK_LENGTH = 145; + private static readonly TEMPLATE_ID = 317; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): OrderAmendKeepPriorityResponse { + const view = new DataView(buffer); + let pos = offset; + + const transactTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executionId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const cumulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const status = view.getUint8(pos); + pos += 1; + + const timeInForce = view.getUint8(pos); + pos += 1; + + const orderType = view.getUint8(pos); + pos += 1; + + const side = view.getUint8(pos); + pos += 1; + + const stopPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const icebergQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const workingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyType = view.getInt32(pos, this.littleEndian); + pos += 4; + + const orderCapacity = view.getUint8(pos); + pos += 1; + + const workingFloor = view.getUint8(pos); + pos += 1; + + const selfTradePreventionMode = view.getUint8(pos); + pos += 1; + + const usedSor = view.getUint8(pos); + pos += 1; + + const pegPriceType = view.getUint8(pos); + pos += 1; + + const pegOffsetType = view.getUint8(pos); + pos += 1; + + const pegOffsetValue = view.getUint8(pos); + pos += 1; + + const peggedPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + OrderAmendKeepPriorityResponseDecoder.BLOCK_LENGTH; + + const listStatus = this.decodeListStatusGroup(view, pos); + pos = listStatus.nextOffset; + + const relatedOrders = this.decodeRelatedOrdersGroup(view, pos); + pos = relatedOrders.nextOffset; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + const origClientOrderId = this.decodeVarData(view, pos); + pos = origClientOrderId.nextOffset; + + const clientOrderId = this.decodeVarData(view, pos); + pos = clientOrderId.nextOffset; + + return { + transactTime: transactTime, + executionId: executionId, + priceExponent: priceExponent, + qtyExponent: qtyExponent, + orderId: orderId, + orderListId: orderListId, + price: price, + qty: qty, + executedQty: executedQty, + preventedQty: preventedQty, + cumulativeQuoteQty: cumulativeQuoteQty, + status: status, + timeInForce: timeInForce, + orderType: orderType, + side: side, + stopPrice: stopPrice, + trailingDelta: trailingDelta, + trailingTime: trailingTime, + icebergQty: icebergQty, + workingTime: workingTime, + strategyId: strategyId, + strategyType: strategyType, + orderCapacity: orderCapacity, + workingFloor: workingFloor, + selfTradePreventionMode: selfTradePreventionMode, + usedSor: usedSor, + pegPriceType: pegPriceType, + pegOffsetType: pegOffsetType, + pegOffsetValue: pegOffsetValue, + peggedPrice: peggedPrice, + listStatus: listStatus.items, + relatedOrders: relatedOrders.items, + symbol: symbol.value, + origClientOrderId: origClientOrderId.value, + clientOrderId: clientOrderId.value + }; + } + private decodeListStatusGroup(view: DataView, offset: number): { items: ListStatus[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: ListStatus[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const contingencyType = view.getUint8(pos); + pos += 1; + + const listOrderStatus = view.getUint8(pos); + pos += 1; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderListId: orderListId, + contingencyType: contingencyType, + listOrderStatus: listOrderStatus, + orderId: orderId + }); + } + + return { items, nextOffset: pos }; + } + private decodeRelatedOrdersGroup(view: DataView, offset: number): { items: RelatedOrders[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: RelatedOrders[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const cumulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const status = view.getUint8(pos); + pos += 1; + + const timeInForce = view.getUint8(pos); + pos += 1; + + const orderType = view.getUint8(pos); + pos += 1; + + const side = view.getUint8(pos); + pos += 1; + + const stopPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const icebergQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const workingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyType = view.getInt32(pos, this.littleEndian); + pos += 4; + + const orderCapacity = view.getUint8(pos); + pos += 1; + + const workingFloor = view.getUint8(pos); + pos += 1; + + const selfTradePreventionMode = view.getUint8(pos); + pos += 1; + + const usedSor = view.getUint8(pos); + pos += 1; + + const pegPriceType = view.getUint8(pos); + pos += 1; + + const pegOffsetType = view.getUint8(pos); + pos += 1; + + const pegOffsetValue = view.getUint8(pos); + pos += 1; + + const peggedPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderId: orderId, + orderListId: orderListId, + price: price, + qty: qty, + executedQty: executedQty, + preventedQty: preventedQty, + cumulativeQuoteQty: cumulativeQuoteQty, + status: status, + timeInForce: timeInForce, + orderType: orderType, + side: side, + stopPrice: stopPrice, + trailingDelta: trailingDelta, + trailingTime: trailingTime, + icebergQty: icebergQty, + workingTime: workingTime, + strategyId: strategyId, + strategyType: strategyType, + orderCapacity: orderCapacity, + workingFloor: workingFloor, + selfTradePreventionMode: selfTradePreventionMode, + usedSor: usedSor, + pegPriceType: pegPriceType, + pegOffsetType: pegOffsetType, + pegOffsetValue: pegOffsetValue, + peggedPrice: peggedPrice + }); + } + + return { items, nextOffset: pos }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return OrderAmendKeepPriorityResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return OrderAmendKeepPriorityResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return OrderAmendKeepPriorityResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return OrderAmendKeepPriorityResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/OrderAmendmentsResponse.ts b/binance/generated-typescript/spot_sbe/OrderAmendmentsResponse.ts new file mode 100644 index 0000000000..f1542887b2 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OrderAmendmentsResponse.ts @@ -0,0 +1,108 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Amendments { + orderId: bigint; + executionId: bigint; + qtyExponent: number; + origQty: bigint; + newQty: bigint; + time: bigint; +} + +export interface OrderAmendmentsResponse { + amendments: Amendments[]; +} + +export class OrderAmendmentsResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 316; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): OrderAmendmentsResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + OrderAmendmentsResponseDecoder.BLOCK_LENGTH; + + const amendments = this.decodeAmendmentsGroup(view, pos); + pos = amendments.nextOffset; + + return { + amendments: amendments.items + }; + } + private decodeAmendmentsGroup(view: DataView, offset: number): { items: Amendments[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Amendments[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executionId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const origQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const newQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const time = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderId: orderId, + executionId: executionId, + qtyExponent: qtyExponent, + origQty: origQty, + newQty: newQty, + time: time + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return OrderAmendmentsResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return OrderAmendmentsResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return OrderAmendmentsResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return OrderAmendmentsResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/OrderCapacity.ts b/binance/generated-typescript/spot_sbe/OrderCapacity.ts new file mode 100644 index 0000000000..cd64464d66 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OrderCapacity.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum OrderCapacity { + Principal = 1, + Agency = 2, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/OrderListResponse.ts b/binance/generated-typescript/spot_sbe/OrderListResponse.ts new file mode 100644 index 0000000000..09f12fe76d --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OrderListResponse.ts @@ -0,0 +1,130 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Orders { + orderId: bigint; +} + +export interface OrderListResponse { + orderListId: bigint; + contingencyType: number; + listStatusType: number; + listOrderStatus: number; + transactionTime: bigint; + orders: Orders[]; + listClientOrderId: Uint8Array; + symbol: Uint8Array; +} + +export class OrderListResponseDecoder { + private static readonly BLOCK_LENGTH = 19; + private static readonly TEMPLATE_ID = 313; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): OrderListResponse { + const view = new DataView(buffer); + let pos = offset; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const contingencyType = view.getUint8(pos); + pos += 1; + + const listStatusType = view.getUint8(pos); + pos += 1; + + const listOrderStatus = view.getUint8(pos); + pos += 1; + + const transactionTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + OrderListResponseDecoder.BLOCK_LENGTH; + + const orders = this.decodeOrdersGroup(view, pos); + pos = orders.nextOffset; + + const listClientOrderId = this.decodeVarData(view, pos); + pos = listClientOrderId.nextOffset; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + return { + orderListId: orderListId, + contingencyType: contingencyType, + listStatusType: listStatusType, + listOrderStatus: listOrderStatus, + transactionTime: transactionTime, + orders: orders.items, + listClientOrderId: listClientOrderId.value, + symbol: symbol.value + }; + } + private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: Orders[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderId: orderId + }); + } + + return { items, nextOffset: pos }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return OrderListResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return OrderListResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return OrderListResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return OrderListResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/OrderListsResponse.ts b/binance/generated-typescript/spot_sbe/OrderListsResponse.ts new file mode 100644 index 0000000000..e8ded8cce9 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OrderListsResponse.ts @@ -0,0 +1,108 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface OrderLists { + orderListId: bigint; + contingencyType: number; + listStatusType: number; + listOrderStatus: number; + transactionTime: bigint; + orderId: bigint; +} + +export interface OrderListsResponse { + orderLists: OrderLists[]; +} + +export class OrderListsResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 314; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): OrderListsResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + OrderListsResponseDecoder.BLOCK_LENGTH; + + const orderLists = this.decodeOrderListsGroup(view, pos); + pos = orderLists.nextOffset; + + return { + orderLists: orderLists.items + }; + } + private decodeOrderListsGroup(view: DataView, offset: number): { items: OrderLists[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: OrderLists[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const contingencyType = view.getUint8(pos); + pos += 1; + + const listStatusType = view.getUint8(pos); + pos += 1; + + const listOrderStatus = view.getUint8(pos); + pos += 1; + + const transactionTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + orderListId: orderListId, + contingencyType: contingencyType, + listStatusType: listStatusType, + listOrderStatus: listOrderStatus, + transactionTime: transactionTime, + orderId: orderId + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return OrderListsResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return OrderListsResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return OrderListsResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return OrderListsResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/OrderResponse.ts b/binance/generated-typescript/spot_sbe/OrderResponse.ts new file mode 100644 index 0000000000..79f3faf965 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OrderResponse.ts @@ -0,0 +1,235 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface OrderResponse { + priceExponent: number; + qtyExponent: number; + orderId: bigint; + orderListId: bigint; + price: bigint; + origQty: bigint; + executedQty: bigint; + cummulativeQuoteQty: bigint; + status: number; + timeInForce: number; + orderType: number; + side: number; + stopPrice: bigint; + trailingDelta: bigint; + trailingTime: bigint; + icebergQty: bigint; + time: bigint; + updateTime: bigint; + isWorking: number; + workingTime: bigint; + origQuoteOrderQty: bigint; + strategyId: bigint; + strategyType: number; + orderCapacity: number; + workingFloor: number; + selfTradePreventionMode: number; + preventedMatchId: bigint; + preventedQuantity: bigint; + usedSor: number; + pegPriceType: number; + pegOffsetType: number; + pegOffsetValue: number; + peggedPrice: bigint; + symbol: Uint8Array; + clientOrderId: Uint8Array; +} + +export class OrderResponseDecoder { + private static readonly BLOCK_LENGTH = 162; + private static readonly TEMPLATE_ID = 304; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): OrderResponse { + const view = new DataView(buffer); + let pos = offset; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const origQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const status = view.getUint8(pos); + pos += 1; + + const timeInForce = view.getUint8(pos); + pos += 1; + + const orderType = view.getUint8(pos); + pos += 1; + + const side = view.getUint8(pos); + pos += 1; + + const stopPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const icebergQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const time = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const updateTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const isWorking = view.getUint8(pos); + pos += 1; + + const workingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyType = view.getInt32(pos, this.littleEndian); + pos += 4; + + const orderCapacity = view.getUint8(pos); + pos += 1; + + const workingFloor = view.getUint8(pos); + pos += 1; + + const selfTradePreventionMode = view.getUint8(pos); + pos += 1; + + const preventedMatchId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const usedSor = view.getUint8(pos); + pos += 1; + + const pegPriceType = view.getUint8(pos); + pos += 1; + + const pegOffsetType = view.getUint8(pos); + pos += 1; + + const pegOffsetValue = view.getUint8(pos); + pos += 1; + + const peggedPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + OrderResponseDecoder.BLOCK_LENGTH; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + const clientOrderId = this.decodeVarData(view, pos); + pos = clientOrderId.nextOffset; + + return { + priceExponent: priceExponent, + qtyExponent: qtyExponent, + orderId: orderId, + orderListId: orderListId, + price: price, + origQty: origQty, + executedQty: executedQty, + cummulativeQuoteQty: cummulativeQuoteQty, + status: status, + timeInForce: timeInForce, + orderType: orderType, + side: side, + stopPrice: stopPrice, + trailingDelta: trailingDelta, + trailingTime: trailingTime, + icebergQty: icebergQty, + time: time, + updateTime: updateTime, + isWorking: isWorking, + workingTime: workingTime, + origQuoteOrderQty: origQuoteOrderQty, + strategyId: strategyId, + strategyType: strategyType, + orderCapacity: orderCapacity, + workingFloor: workingFloor, + selfTradePreventionMode: selfTradePreventionMode, + preventedMatchId: preventedMatchId, + preventedQuantity: preventedQuantity, + usedSor: usedSor, + pegPriceType: pegPriceType, + pegOffsetType: pegOffsetType, + pegOffsetValue: pegOffsetValue, + peggedPrice: peggedPrice, + symbol: symbol.value, + clientOrderId: clientOrderId.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return OrderResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return OrderResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return OrderResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return OrderResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/OrderSide.ts b/binance/generated-typescript/spot_sbe/OrderSide.ts new file mode 100644 index 0000000000..8514b5681f --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OrderSide.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum OrderSide { + Buy = 0, + Sell = 1, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/OrderStatus.ts b/binance/generated-typescript/spot_sbe/OrderStatus.ts new file mode 100644 index 0000000000..8de912ded9 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OrderStatus.ts @@ -0,0 +1,19 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum OrderStatus { + New = 0, + PartiallyFilled = 1, + Filled = 2, + Canceled = 3, + PendingCancel = 4, + Rejected = 5, + Expired = 6, + ExpiredInMatch = 9, + PendingNew = 11, + Unknown = 253, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/OrderTestResponse.ts b/binance/generated-typescript/spot_sbe/OrderTestResponse.ts new file mode 100644 index 0000000000..c5f2132a37 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OrderTestResponse.ts @@ -0,0 +1,48 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface OrderTestResponse { +} + +export class OrderTestResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 303; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): OrderTestResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + OrderTestResponseDecoder.BLOCK_LENGTH; + + return { + }; + } + + static getBlockLength(): number { + return OrderTestResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return OrderTestResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return OrderTestResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return OrderTestResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/OrderTestWithCommissionsResponse.ts b/binance/generated-typescript/spot_sbe/OrderTestWithCommissionsResponse.ts new file mode 100644 index 0000000000..364f56cc03 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OrderTestWithCommissionsResponse.ts @@ -0,0 +1,120 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface OrderTestWithCommissionsResponse { + commissionExponent: number; + discountExponent: number; + standardCommissionForOrderMaker: bigint; + standardCommissionForOrderTaker: bigint; + taxCommissionForOrderMaker: bigint; + taxCommissionForOrderTaker: bigint; + discountEnabledForAccount: number; + discountEnabledForSymbol: number; + discount: bigint; + specialCommissionForOrderMaker: bigint; + specialCommissionForOrderTaker: bigint; + discountAsset: Uint8Array; +} + +export class OrderTestWithCommissionsResponseDecoder { + private static readonly BLOCK_LENGTH = 60; + private static readonly TEMPLATE_ID = 315; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): OrderTestWithCommissionsResponse { + const view = new DataView(buffer); + let pos = offset; + + const commissionExponent = view.getInt8(pos); + pos += 1; + + const discountExponent = view.getInt8(pos); + pos += 1; + + const standardCommissionForOrderMaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const standardCommissionForOrderTaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const taxCommissionForOrderMaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const taxCommissionForOrderTaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const discountEnabledForAccount = view.getUint8(pos); + pos += 1; + + const discountEnabledForSymbol = view.getUint8(pos); + pos += 1; + + const discount = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const specialCommissionForOrderMaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const specialCommissionForOrderTaker = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + OrderTestWithCommissionsResponseDecoder.BLOCK_LENGTH; + + const discountAsset = this.decodeVarData(view, pos); + pos = discountAsset.nextOffset; + + return { + commissionExponent: commissionExponent, + discountExponent: discountExponent, + standardCommissionForOrderMaker: standardCommissionForOrderMaker, + standardCommissionForOrderTaker: standardCommissionForOrderTaker, + taxCommissionForOrderMaker: taxCommissionForOrderMaker, + taxCommissionForOrderTaker: taxCommissionForOrderTaker, + discountEnabledForAccount: discountEnabledForAccount, + discountEnabledForSymbol: discountEnabledForSymbol, + discount: discount, + specialCommissionForOrderMaker: specialCommissionForOrderMaker, + specialCommissionForOrderTaker: specialCommissionForOrderTaker, + discountAsset: discountAsset.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return OrderTestWithCommissionsResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return OrderTestWithCommissionsResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return OrderTestWithCommissionsResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return OrderTestWithCommissionsResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/OrderType.ts b/binance/generated-typescript/spot_sbe/OrderType.ts new file mode 100644 index 0000000000..a55a656883 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OrderType.ts @@ -0,0 +1,16 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum OrderType { + Market = 0, + Limit = 1, + StopLoss = 2, + StopLossLimit = 3, + TakeProfit = 4, + TakeProfitLimit = 5, + LimitMaker = 6, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/OrderTypes.ts b/binance/generated-typescript/spot_sbe/OrderTypes.ts new file mode 100644 index 0000000000..07c3125a68 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OrderTypes.ts @@ -0,0 +1,37 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface OrderTypes { + market: boolean; + limit: boolean; + stopLoss: boolean; + stopLossLimit: boolean; + takeProfit: boolean; + takeProfitLimit: boolean; + limitMaker: boolean; + nonRepresentable: boolean; +} + +export class OrderTypesDecoder { + static decode(view: DataView, offset: number, littleEndian: boolean): OrderTypes { + const bits = view.getUint16(offset, littleEndian); + + return { + market: (bits & (1 << 0)) !== 0, + limit: (bits & (1 << 1)) !== 0, + stopLoss: (bits & (1 << 2)) !== 0, + stopLossLimit: (bits & (1 << 3)) !== 0, + takeProfit: (bits & (1 << 4)) !== 0, + takeProfitLimit: (bits & (1 << 5)) !== 0, + limitMaker: (bits & (1 << 6)) !== 0, + nonRepresentable: (bits & (1 << 15)) !== 0 + }; + } + + static getEncodedLength(): number { + return 2; + } +} diff --git a/binance/generated-typescript/spot_sbe/OrdersResponse.ts b/binance/generated-typescript/spot_sbe/OrdersResponse.ts new file mode 100644 index 0000000000..388a334214 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OrdersResponse.ts @@ -0,0 +1,243 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Orders { + priceExponent: number; + qtyExponent: number; + orderId: bigint; + orderListId: bigint; + price: bigint; + origQty: bigint; + executedQty: bigint; + cummulativeQuoteQty: bigint; + status: number; + timeInForce: number; + orderType: number; + side: number; + stopPrice: bigint; + trailingDelta: bigint; + trailingTime: bigint; + icebergQty: bigint; + time: bigint; + updateTime: bigint; + isWorking: number; + workingTime: bigint; + origQuoteOrderQty: bigint; + strategyId: bigint; + strategyType: number; + orderCapacity: number; + workingFloor: number; + selfTradePreventionMode: number; + preventedMatchId: bigint; + preventedQuantity: bigint; + usedSor: number; + pegPriceType: number; + pegOffsetType: number; + pegOffsetValue: number; + peggedPrice: bigint; +} + +export interface OrdersResponse { + orders: Orders[]; +} + +export class OrdersResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 308; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): OrdersResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + OrdersResponseDecoder.BLOCK_LENGTH; + + const orders = this.decodeOrdersGroup(view, pos); + pos = orders.nextOffset; + + return { + orders: orders.items + }; + } + private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Orders[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const orderListId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const origQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const executedQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const status = view.getUint8(pos); + pos += 1; + + const timeInForce = view.getUint8(pos); + pos += 1; + + const orderType = view.getUint8(pos); + pos += 1; + + const side = view.getUint8(pos); + pos += 1; + + const stopPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const trailingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const icebergQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const time = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const updateTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const isWorking = view.getUint8(pos); + pos += 1; + + const workingTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const strategyType = view.getInt32(pos, this.littleEndian); + pos += 4; + + const orderCapacity = view.getUint8(pos); + pos += 1; + + const workingFloor = view.getUint8(pos); + pos += 1; + + const selfTradePreventionMode = view.getUint8(pos); + pos += 1; + + const preventedMatchId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const preventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const usedSor = view.getUint8(pos); + pos += 1; + + const pegPriceType = view.getUint8(pos); + pos += 1; + + const pegOffsetType = view.getUint8(pos); + pos += 1; + + const pegOffsetValue = view.getUint8(pos); + pos += 1; + + const peggedPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + priceExponent: priceExponent, + qtyExponent: qtyExponent, + orderId: orderId, + orderListId: orderListId, + price: price, + origQty: origQty, + executedQty: executedQty, + cummulativeQuoteQty: cummulativeQuoteQty, + status: status, + timeInForce: timeInForce, + orderType: orderType, + side: side, + stopPrice: stopPrice, + trailingDelta: trailingDelta, + trailingTime: trailingTime, + icebergQty: icebergQty, + time: time, + updateTime: updateTime, + isWorking: isWorking, + workingTime: workingTime, + origQuoteOrderQty: origQuoteOrderQty, + strategyId: strategyId, + strategyType: strategyType, + orderCapacity: orderCapacity, + workingFloor: workingFloor, + selfTradePreventionMode: selfTradePreventionMode, + preventedMatchId: preventedMatchId, + preventedQuantity: preventedQuantity, + usedSor: usedSor, + pegPriceType: pegPriceType, + pegOffsetType: pegOffsetType, + pegOffsetValue: pegOffsetValue, + peggedPrice: peggedPrice + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return OrdersResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return OrdersResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return OrdersResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return OrdersResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/OutboundAccountPositionEvent.ts b/binance/generated-typescript/spot_sbe/OutboundAccountPositionEvent.ts new file mode 100644 index 0000000000..4b23c9879a --- /dev/null +++ b/binance/generated-typescript/spot_sbe/OutboundAccountPositionEvent.ts @@ -0,0 +1,108 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Balances { + exponent: number; + free: bigint; + locked: bigint; +} + +export interface OutboundAccountPositionEvent { + eventTime: bigint; + updateTime: bigint; + subscriptionId: number; + balances: Balances[]; +} + +export class OutboundAccountPositionEventDecoder { + private static readonly BLOCK_LENGTH = 18; + private static readonly TEMPLATE_ID = 607; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): OutboundAccountPositionEvent { + const view = new DataView(buffer); + let pos = offset; + + const eventTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const updateTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const subscriptionId = view.getUint16(pos, this.littleEndian); + pos += 2; + + // Skip to end of block for forward compatibility + pos = offset + OutboundAccountPositionEventDecoder.BLOCK_LENGTH; + + const balances = this.decodeBalancesGroup(view, pos); + pos = balances.nextOffset; + + return { + eventTime: eventTime, + updateTime: updateTime, + subscriptionId: subscriptionId, + balances: balances.items + }; + } + private decodeBalancesGroup(view: DataView, offset: number): { items: Balances[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Balances[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const exponent = view.getInt8(pos); + pos += 1; + + const free = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const locked = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + exponent: exponent, + free: free, + locked: locked + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return OutboundAccountPositionEventDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return OutboundAccountPositionEventDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return OutboundAccountPositionEventDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return OutboundAccountPositionEventDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/PegOffsetType.ts b/binance/generated-typescript/spot_sbe/PegOffsetType.ts new file mode 100644 index 0000000000..65d1a988e5 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/PegOffsetType.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum PegOffsetType { + PriceLevel = 1, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/PegPriceType.ts b/binance/generated-typescript/spot_sbe/PegPriceType.ts new file mode 100644 index 0000000000..a9bfa456ab --- /dev/null +++ b/binance/generated-typescript/spot_sbe/PegPriceType.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum PegPriceType { + PrimaryPeg = 1, + MarketPeg = 2, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/PercentPriceBySideFilter.ts b/binance/generated-typescript/spot_sbe/PercentPriceBySideFilter.ts new file mode 100644 index 0000000000..ccb0ea7806 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/PercentPriceBySideFilter.ts @@ -0,0 +1,83 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface PercentPriceBySideFilter { + filterType: number; + multiplierExponent: number; + bidMultiplierUp: bigint; + bidMultiplierDown: bigint; + askMultiplierUp: bigint; + askMultiplierDown: bigint; + avgPriceMins: number; +} + +export class PercentPriceBySideFilterDecoder { + private static readonly BLOCK_LENGTH = 37; + private static readonly TEMPLATE_ID = 3; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): PercentPriceBySideFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const multiplierExponent = view.getInt8(pos); + pos += 1; + + const bidMultiplierUp = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const bidMultiplierDown = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const askMultiplierUp = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const askMultiplierDown = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const avgPriceMins = view.getInt32(pos, this.littleEndian); + pos += 4; + + // Skip to end of block for forward compatibility + pos = offset + PercentPriceBySideFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + multiplierExponent: multiplierExponent, + bidMultiplierUp: bidMultiplierUp, + bidMultiplierDown: bidMultiplierDown, + askMultiplierUp: askMultiplierUp, + askMultiplierDown: askMultiplierDown, + avgPriceMins: avgPriceMins + }; + } + + static getBlockLength(): number { + return PercentPriceBySideFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return PercentPriceBySideFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return PercentPriceBySideFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return PercentPriceBySideFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/PercentPriceFilter.ts b/binance/generated-typescript/spot_sbe/PercentPriceFilter.ts new file mode 100644 index 0000000000..a045453127 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/PercentPriceFilter.ts @@ -0,0 +1,73 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface PercentPriceFilter { + filterType: number; + multiplierExponent: number; + multiplierUp: bigint; + multiplierDown: bigint; + avgPriceMins: number; +} + +export class PercentPriceFilterDecoder { + private static readonly BLOCK_LENGTH = 21; + private static readonly TEMPLATE_ID = 2; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): PercentPriceFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const multiplierExponent = view.getInt8(pos); + pos += 1; + + const multiplierUp = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const multiplierDown = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const avgPriceMins = view.getInt32(pos, this.littleEndian); + pos += 4; + + // Skip to end of block for forward compatibility + pos = offset + PercentPriceFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + multiplierExponent: multiplierExponent, + multiplierUp: multiplierUp, + multiplierDown: multiplierDown, + avgPriceMins: avgPriceMins + }; + } + + static getBlockLength(): number { + return PercentPriceFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return PercentPriceFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return PercentPriceFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return PercentPriceFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/PingResponse.ts b/binance/generated-typescript/spot_sbe/PingResponse.ts new file mode 100644 index 0000000000..35d935ca08 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/PingResponse.ts @@ -0,0 +1,48 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface PingResponse { +} + +export class PingResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 101; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): PingResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + PingResponseDecoder.BLOCK_LENGTH; + + return { + }; + } + + static getBlockLength(): number { + return PingResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return PingResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return PingResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return PingResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/PriceFilter.ts b/binance/generated-typescript/spot_sbe/PriceFilter.ts new file mode 100644 index 0000000000..2961fa3102 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/PriceFilter.ts @@ -0,0 +1,73 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface PriceFilter { + filterType: number; + priceExponent: number; + minPrice: bigint; + maxPrice: bigint; + tickSize: bigint; +} + +export class PriceFilterDecoder { + private static readonly BLOCK_LENGTH = 25; + private static readonly TEMPLATE_ID = 1; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): PriceFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const minPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const maxPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const tickSize = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + PriceFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + priceExponent: priceExponent, + minPrice: minPrice, + maxPrice: maxPrice, + tickSize: tickSize + }; + } + + static getBlockLength(): number { + return PriceFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return PriceFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return PriceFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return PriceFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/PriceTickerResponse.ts b/binance/generated-typescript/spot_sbe/PriceTickerResponse.ts new file mode 100644 index 0000000000..47499d6922 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/PriceTickerResponse.ts @@ -0,0 +1,88 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Tickers { + priceExponent: number; + price: bigint; +} + +export interface PriceTickerResponse { + tickers: Tickers[]; +} + +export class PriceTickerResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 210; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): PriceTickerResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + PriceTickerResponseDecoder.BLOCK_LENGTH; + + const tickers = this.decodeTickersGroup(view, pos); + pos = tickers.nextOffset; + + return { + tickers: tickers.items + }; + } + private decodeTickersGroup(view: DataView, offset: number): { items: Tickers[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Tickers[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + priceExponent: priceExponent, + price: price + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return PriceTickerResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return PriceTickerResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return PriceTickerResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return PriceTickerResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/PriceTickerSymbolResponse.ts b/binance/generated-typescript/spot_sbe/PriceTickerSymbolResponse.ts new file mode 100644 index 0000000000..bfae607ce1 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/PriceTickerSymbolResponse.ts @@ -0,0 +1,75 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface PriceTickerSymbolResponse { + priceExponent: number; + price: bigint; + symbol: Uint8Array; +} + +export class PriceTickerSymbolResponseDecoder { + private static readonly BLOCK_LENGTH = 9; + private static readonly TEMPLATE_ID = 209; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): PriceTickerSymbolResponse { + const view = new DataView(buffer); + let pos = offset; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + PriceTickerSymbolResponseDecoder.BLOCK_LENGTH; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + return { + priceExponent: priceExponent, + price: price, + symbol: symbol.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return PriceTickerSymbolResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return PriceTickerSymbolResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return PriceTickerSymbolResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return PriceTickerSymbolResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/RateLimitInterval.ts b/binance/generated-typescript/spot_sbe/RateLimitInterval.ts new file mode 100644 index 0000000000..a822cd404f --- /dev/null +++ b/binance/generated-typescript/spot_sbe/RateLimitInterval.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum RateLimitInterval { + Second = 0, + Minute = 1, + Hour = 2, + Day = 3, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/RateLimitType.ts b/binance/generated-typescript/spot_sbe/RateLimitType.ts new file mode 100644 index 0000000000..6eadce6667 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/RateLimitType.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum RateLimitType { + RawRequests = 0, + Connections = 1, + RequestWeight = 2, + Orders = 3, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/SelfTradePreventionMode.ts b/binance/generated-typescript/spot_sbe/SelfTradePreventionMode.ts new file mode 100644 index 0000000000..2b8234236c --- /dev/null +++ b/binance/generated-typescript/spot_sbe/SelfTradePreventionMode.ts @@ -0,0 +1,15 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum SelfTradePreventionMode { + None = 1, + ExpireTaker = 2, + ExpireMaker = 3, + ExpireBoth = 4, + Decrement = 5, + Transfer = 6, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/ServerTimeResponse.ts b/binance/generated-typescript/spot_sbe/ServerTimeResponse.ts new file mode 100644 index 0000000000..c0d4f9d191 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/ServerTimeResponse.ts @@ -0,0 +1,53 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface ServerTimeResponse { + serverTime: bigint; +} + +export class ServerTimeResponseDecoder { + private static readonly BLOCK_LENGTH = 8; + private static readonly TEMPLATE_ID = 102; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): ServerTimeResponse { + const view = new DataView(buffer); + let pos = offset; + + const serverTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + ServerTimeResponseDecoder.BLOCK_LENGTH; + + return { + serverTime: serverTime + }; + } + + static getBlockLength(): number { + return ServerTimeResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return ServerTimeResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return ServerTimeResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return ServerTimeResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/SymbolStatus.ts b/binance/generated-typescript/spot_sbe/SymbolStatus.ts new file mode 100644 index 0000000000..351a2d1bf2 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/SymbolStatus.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum SymbolStatus { + Trading = 0, + EndOfDay = 1, + Halt = 2, + Break = 3, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/TPlusFilterLockEvent.ts b/binance/generated-typescript/spot_sbe/TPlusFilterLockEvent.ts new file mode 100644 index 0000000000..73832de071 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/TPlusFilterLockEvent.ts @@ -0,0 +1,125 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface UnlockData { + unlockTime: bigint; + qty: bigint; +} + +export interface TPlusFilterLockEvent { + eventTime: bigint; + qtyExponent: number; + subscriptionId: number; + unlockData: UnlockData[]; + symbol: Uint8Array; + baseAsset: Uint8Array; +} + +export class TPlusFilterLockEventDecoder { + private static readonly BLOCK_LENGTH = 11; + private static readonly TEMPLATE_ID = 608; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): TPlusFilterLockEvent { + const view = new DataView(buffer); + let pos = offset; + + const eventTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const subscriptionId = view.getUint16(pos, this.littleEndian); + pos += 2; + + // Skip to end of block for forward compatibility + pos = offset + TPlusFilterLockEventDecoder.BLOCK_LENGTH; + + const unlockData = this.decodeUnlockDataGroup(view, pos); + pos = unlockData.nextOffset; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + const baseAsset = this.decodeVarData(view, pos); + pos = baseAsset.nextOffset; + + return { + eventTime: eventTime, + qtyExponent: qtyExponent, + subscriptionId: subscriptionId, + unlockData: unlockData.items, + symbol: symbol.value, + baseAsset: baseAsset.value + }; + } + private decodeUnlockDataGroup(view: DataView, offset: number): { items: UnlockData[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: UnlockData[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const unlockTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + unlockTime: unlockTime, + qty: qty + }); + } + + return { items, nextOffset: pos }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return TPlusFilterLockEventDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return TPlusFilterLockEventDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return TPlusFilterLockEventDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return TPlusFilterLockEventDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/TPlusSellFilter.ts b/binance/generated-typescript/spot_sbe/TPlusSellFilter.ts new file mode 100644 index 0000000000..d773942ede --- /dev/null +++ b/binance/generated-typescript/spot_sbe/TPlusSellFilter.ts @@ -0,0 +1,58 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface TPlusSellFilter { + filterType: number; + endTime: bigint; +} + +export class TPlusSellFilterDecoder { + private static readonly BLOCK_LENGTH = 8; + private static readonly TEMPLATE_ID = 14; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): TPlusSellFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const endTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + TPlusSellFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + endTime: endTime + }; + } + + static getBlockLength(): number { + return TPlusSellFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return TPlusSellFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return TPlusSellFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return TPlusSellFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/Ticker24hFullResponse.ts b/binance/generated-typescript/spot_sbe/Ticker24hFullResponse.ts new file mode 100644 index 0000000000..113acdfb9d --- /dev/null +++ b/binance/generated-typescript/spot_sbe/Ticker24hFullResponse.ts @@ -0,0 +1,188 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Tickers { + priceExponent: number; + qtyExponent: number; + priceChange: bigint; + priceChangePercent: number; + weightedAvgPrice: bigint; + prevClosePrice: bigint; + lastPrice: bigint; + lastQty: number; + bidPrice: bigint; + bidQty: bigint; + askPrice: bigint; + askQty: bigint; + openPrice: bigint; + highPrice: bigint; + lowPrice: bigint; + volume: number; + quoteVolume: number; + openTime: bigint; + closeTime: bigint; + firstId: bigint; + lastId: bigint; + numTrades: bigint; +} + +export interface Ticker24hFullResponse { + tickers: Tickers[]; +} + +export class Ticker24hFullResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 206; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): Ticker24hFullResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + Ticker24hFullResponseDecoder.BLOCK_LENGTH; + + const tickers = this.decodeTickersGroup(view, pos); + pos = tickers.nextOffset; + + return { + tickers: tickers.items + }; + } + private decodeTickersGroup(view: DataView, offset: number): { items: Tickers[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Tickers[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const priceChange = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const priceChangePercent = view.getFloat32(pos, this.littleEndian); + pos += 4; + + const weightedAvgPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const prevClosePrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastQty = view.getUint8(pos); + pos += 16; + + const bidPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const bidQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const askPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const askQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const openPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const highPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lowPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const volume = view.getUint8(pos); + pos += 16; + + const quoteVolume = view.getUint8(pos); + pos += 16; + + const openTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const closeTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const firstId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const numTrades = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + priceExponent: priceExponent, + qtyExponent: qtyExponent, + priceChange: priceChange, + priceChangePercent: priceChangePercent, + weightedAvgPrice: weightedAvgPrice, + prevClosePrice: prevClosePrice, + lastPrice: lastPrice, + lastQty: lastQty, + bidPrice: bidPrice, + bidQty: bidQty, + askPrice: askPrice, + askQty: askQty, + openPrice: openPrice, + highPrice: highPrice, + lowPrice: lowPrice, + volume: volume, + quoteVolume: quoteVolume, + openTime: openTime, + closeTime: closeTime, + firstId: firstId, + lastId: lastId, + numTrades: numTrades + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return Ticker24hFullResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return Ticker24hFullResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return Ticker24hFullResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return Ticker24hFullResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/Ticker24hMiniResponse.ts b/binance/generated-typescript/spot_sbe/Ticker24hMiniResponse.ts new file mode 100644 index 0000000000..9cd17bf86c --- /dev/null +++ b/binance/generated-typescript/spot_sbe/Ticker24hMiniResponse.ts @@ -0,0 +1,143 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Tickers { + priceExponent: number; + qtyExponent: number; + openPrice: bigint; + highPrice: bigint; + lowPrice: bigint; + lastPrice: bigint; + volume: number; + quoteVolume: number; + openTime: bigint; + closeTime: bigint; + firstId: bigint; + lastId: bigint; + numTrades: bigint; +} + +export interface Ticker24hMiniResponse { + tickers: Tickers[]; +} + +export class Ticker24hMiniResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 208; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): Ticker24hMiniResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + Ticker24hMiniResponseDecoder.BLOCK_LENGTH; + + const tickers = this.decodeTickersGroup(view, pos); + pos = tickers.nextOffset; + + return { + tickers: tickers.items + }; + } + private decodeTickersGroup(view: DataView, offset: number): { items: Tickers[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Tickers[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const openPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const highPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lowPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const volume = view.getUint8(pos); + pos += 16; + + const quoteVolume = view.getUint8(pos); + pos += 16; + + const openTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const closeTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const firstId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const numTrades = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + priceExponent: priceExponent, + qtyExponent: qtyExponent, + openPrice: openPrice, + highPrice: highPrice, + lowPrice: lowPrice, + lastPrice: lastPrice, + volume: volume, + quoteVolume: quoteVolume, + openTime: openTime, + closeTime: closeTime, + firstId: firstId, + lastId: lastId, + numTrades: numTrades + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return Ticker24hMiniResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return Ticker24hMiniResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return Ticker24hMiniResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return Ticker24hMiniResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/Ticker24hSymbolFullResponse.ts b/binance/generated-typescript/spot_sbe/Ticker24hSymbolFullResponse.ts new file mode 100644 index 0000000000..d6e4b6aaea --- /dev/null +++ b/binance/generated-typescript/spot_sbe/Ticker24hSymbolFullResponse.ts @@ -0,0 +1,175 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Ticker24hSymbolFullResponse { + priceExponent: number; + qtyExponent: number; + priceChange: bigint; + priceChangePercent: number; + weightedAvgPrice: bigint; + prevClosePrice: bigint; + lastPrice: bigint; + lastQty: number; + bidPrice: bigint; + bidQty: bigint; + askPrice: bigint; + askQty: bigint; + openPrice: bigint; + highPrice: bigint; + lowPrice: bigint; + volume: number; + quoteVolume: number; + openTime: bigint; + closeTime: bigint; + firstId: bigint; + lastId: bigint; + numTrades: bigint; + symbol: Uint8Array; +} + +export class Ticker24hSymbolFullResponseDecoder { + private static readonly BLOCK_LENGTH = 182; + private static readonly TEMPLATE_ID = 205; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): Ticker24hSymbolFullResponse { + const view = new DataView(buffer); + let pos = offset; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const priceChange = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const priceChangePercent = view.getFloat32(pos, this.littleEndian); + pos += 4; + + const weightedAvgPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const prevClosePrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastQty = view.getUint8(pos); + pos += 16; + + const bidPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const bidQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const askPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const askQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const openPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const highPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lowPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const volume = view.getUint8(pos); + pos += 16; + + const quoteVolume = view.getUint8(pos); + pos += 16; + + const openTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const closeTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const firstId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const numTrades = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + Ticker24hSymbolFullResponseDecoder.BLOCK_LENGTH; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + return { + priceExponent: priceExponent, + qtyExponent: qtyExponent, + priceChange: priceChange, + priceChangePercent: priceChangePercent, + weightedAvgPrice: weightedAvgPrice, + prevClosePrice: prevClosePrice, + lastPrice: lastPrice, + lastQty: lastQty, + bidPrice: bidPrice, + bidQty: bidQty, + askPrice: askPrice, + askQty: askQty, + openPrice: openPrice, + highPrice: highPrice, + lowPrice: lowPrice, + volume: volume, + quoteVolume: quoteVolume, + openTime: openTime, + closeTime: closeTime, + firstId: firstId, + lastId: lastId, + numTrades: numTrades, + symbol: symbol.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return Ticker24hSymbolFullResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return Ticker24hSymbolFullResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return Ticker24hSymbolFullResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return Ticker24hSymbolFullResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/Ticker24hSymbolMiniResponse.ts b/binance/generated-typescript/spot_sbe/Ticker24hSymbolMiniResponse.ts new file mode 100644 index 0000000000..71d6a19b59 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/Ticker24hSymbolMiniResponse.ts @@ -0,0 +1,130 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Ticker24hSymbolMiniResponse { + priceExponent: number; + qtyExponent: number; + openPrice: bigint; + highPrice: bigint; + lowPrice: bigint; + lastPrice: bigint; + volume: number; + quoteVolume: number; + openTime: bigint; + closeTime: bigint; + firstId: bigint; + lastId: bigint; + numTrades: bigint; + symbol: Uint8Array; +} + +export class Ticker24hSymbolMiniResponseDecoder { + private static readonly BLOCK_LENGTH = 106; + private static readonly TEMPLATE_ID = 207; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): Ticker24hSymbolMiniResponse { + const view = new DataView(buffer); + let pos = offset; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const openPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const highPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lowPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const volume = view.getUint8(pos); + pos += 16; + + const quoteVolume = view.getUint8(pos); + pos += 16; + + const openTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const closeTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const firstId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const numTrades = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + Ticker24hSymbolMiniResponseDecoder.BLOCK_LENGTH; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + return { + priceExponent: priceExponent, + qtyExponent: qtyExponent, + openPrice: openPrice, + highPrice: highPrice, + lowPrice: lowPrice, + lastPrice: lastPrice, + volume: volume, + quoteVolume: quoteVolume, + openTime: openTime, + closeTime: closeTime, + firstId: firstId, + lastId: lastId, + numTrades: numTrades, + symbol: symbol.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return Ticker24hSymbolMiniResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return Ticker24hSymbolMiniResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return Ticker24hSymbolMiniResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return Ticker24hSymbolMiniResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/TickerFullResponse.ts b/binance/generated-typescript/spot_sbe/TickerFullResponse.ts new file mode 100644 index 0000000000..5bb72655a2 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/TickerFullResponse.ts @@ -0,0 +1,158 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Tickers { + priceExponent: number; + qtyExponent: number; + priceChange: bigint; + priceChangePercent: number; + weightedAvgPrice: bigint; + openPrice: bigint; + highPrice: bigint; + lowPrice: bigint; + lastPrice: bigint; + volume: number; + quoteVolume: number; + openTime: bigint; + closeTime: bigint; + firstId: bigint; + lastId: bigint; + numTrades: bigint; +} + +export interface TickerFullResponse { + tickers: Tickers[]; +} + +export class TickerFullResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 214; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): TickerFullResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + TickerFullResponseDecoder.BLOCK_LENGTH; + + const tickers = this.decodeTickersGroup(view, pos); + pos = tickers.nextOffset; + + return { + tickers: tickers.items + }; + } + private decodeTickersGroup(view: DataView, offset: number): { items: Tickers[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Tickers[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const priceChange = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const priceChangePercent = view.getFloat32(pos, this.littleEndian); + pos += 4; + + const weightedAvgPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const openPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const highPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lowPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const volume = view.getUint8(pos); + pos += 16; + + const quoteVolume = view.getUint8(pos); + pos += 16; + + const openTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const closeTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const firstId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const numTrades = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + priceExponent: priceExponent, + qtyExponent: qtyExponent, + priceChange: priceChange, + priceChangePercent: priceChangePercent, + weightedAvgPrice: weightedAvgPrice, + openPrice: openPrice, + highPrice: highPrice, + lowPrice: lowPrice, + lastPrice: lastPrice, + volume: volume, + quoteVolume: quoteVolume, + openTime: openTime, + closeTime: closeTime, + firstId: firstId, + lastId: lastId, + numTrades: numTrades + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return TickerFullResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return TickerFullResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return TickerFullResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return TickerFullResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/TickerMiniResponse.ts b/binance/generated-typescript/spot_sbe/TickerMiniResponse.ts new file mode 100644 index 0000000000..06b68a3422 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/TickerMiniResponse.ts @@ -0,0 +1,143 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Tickers { + priceExponent: number; + qtyExponent: number; + openPrice: bigint; + highPrice: bigint; + lowPrice: bigint; + lastPrice: bigint; + volume: number; + quoteVolume: number; + openTime: bigint; + closeTime: bigint; + firstId: bigint; + lastId: bigint; + numTrades: bigint; +} + +export interface TickerMiniResponse { + tickers: Tickers[]; +} + +export class TickerMiniResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 216; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): TickerMiniResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + TickerMiniResponseDecoder.BLOCK_LENGTH; + + const tickers = this.decodeTickersGroup(view, pos); + pos = tickers.nextOffset; + + return { + tickers: tickers.items + }; + } + private decodeTickersGroup(view: DataView, offset: number): { items: Tickers[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Tickers[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const openPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const highPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lowPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const volume = view.getUint8(pos); + pos += 16; + + const quoteVolume = view.getUint8(pos); + pos += 16; + + const openTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const closeTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const firstId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const numTrades = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + priceExponent: priceExponent, + qtyExponent: qtyExponent, + openPrice: openPrice, + highPrice: highPrice, + lowPrice: lowPrice, + lastPrice: lastPrice, + volume: volume, + quoteVolume: quoteVolume, + openTime: openTime, + closeTime: closeTime, + firstId: firstId, + lastId: lastId, + numTrades: numTrades + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return TickerMiniResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return TickerMiniResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return TickerMiniResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return TickerMiniResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/TickerSymbolFullResponse.ts b/binance/generated-typescript/spot_sbe/TickerSymbolFullResponse.ts new file mode 100644 index 0000000000..cd495e605d --- /dev/null +++ b/binance/generated-typescript/spot_sbe/TickerSymbolFullResponse.ts @@ -0,0 +1,145 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface TickerSymbolFullResponse { + priceExponent: number; + qtyExponent: number; + priceChange: bigint; + priceChangePercent: number; + weightedAvgPrice: bigint; + openPrice: bigint; + highPrice: bigint; + lowPrice: bigint; + lastPrice: bigint; + volume: number; + quoteVolume: number; + openTime: bigint; + closeTime: bigint; + firstId: bigint; + lastId: bigint; + numTrades: bigint; + symbol: Uint8Array; +} + +export class TickerSymbolFullResponseDecoder { + private static readonly BLOCK_LENGTH = 126; + private static readonly TEMPLATE_ID = 213; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): TickerSymbolFullResponse { + const view = new DataView(buffer); + let pos = offset; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const priceChange = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const priceChangePercent = view.getFloat32(pos, this.littleEndian); + pos += 4; + + const weightedAvgPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const openPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const highPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lowPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const volume = view.getUint8(pos); + pos += 16; + + const quoteVolume = view.getUint8(pos); + pos += 16; + + const openTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const closeTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const firstId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const numTrades = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + TickerSymbolFullResponseDecoder.BLOCK_LENGTH; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + return { + priceExponent: priceExponent, + qtyExponent: qtyExponent, + priceChange: priceChange, + priceChangePercent: priceChangePercent, + weightedAvgPrice: weightedAvgPrice, + openPrice: openPrice, + highPrice: highPrice, + lowPrice: lowPrice, + lastPrice: lastPrice, + volume: volume, + quoteVolume: quoteVolume, + openTime: openTime, + closeTime: closeTime, + firstId: firstId, + lastId: lastId, + numTrades: numTrades, + symbol: symbol.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return TickerSymbolFullResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return TickerSymbolFullResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return TickerSymbolFullResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return TickerSymbolFullResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/TickerSymbolMiniResponse.ts b/binance/generated-typescript/spot_sbe/TickerSymbolMiniResponse.ts new file mode 100644 index 0000000000..a622c6a69a --- /dev/null +++ b/binance/generated-typescript/spot_sbe/TickerSymbolMiniResponse.ts @@ -0,0 +1,130 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface TickerSymbolMiniResponse { + priceExponent: number; + qtyExponent: number; + openPrice: bigint; + highPrice: bigint; + lowPrice: bigint; + lastPrice: bigint; + volume: number; + quoteVolume: number; + openTime: bigint; + closeTime: bigint; + firstId: bigint; + lastId: bigint; + numTrades: bigint; + symbol: Uint8Array; +} + +export class TickerSymbolMiniResponseDecoder { + private static readonly BLOCK_LENGTH = 106; + private static readonly TEMPLATE_ID = 215; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): TickerSymbolMiniResponse { + const view = new DataView(buffer); + let pos = offset; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + const openPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const highPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lowPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastPrice = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const volume = view.getUint8(pos); + pos += 16; + + const quoteVolume = view.getUint8(pos); + pos += 16; + + const openTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const closeTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const firstId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const lastId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const numTrades = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + TickerSymbolMiniResponseDecoder.BLOCK_LENGTH; + + const symbol = this.decodeVarData(view, pos); + pos = symbol.nextOffset; + + return { + priceExponent: priceExponent, + qtyExponent: qtyExponent, + openPrice: openPrice, + highPrice: highPrice, + lowPrice: lowPrice, + lastPrice: lastPrice, + volume: volume, + quoteVolume: quoteVolume, + openTime: openTime, + closeTime: closeTime, + firstId: firstId, + lastId: lastId, + numTrades: numTrades, + symbol: symbol.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return TickerSymbolMiniResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return TickerSymbolMiniResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return TickerSymbolMiniResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return TickerSymbolMiniResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/TimeInForce.ts b/binance/generated-typescript/spot_sbe/TimeInForce.ts new file mode 100644 index 0000000000..da3ee329d9 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/TimeInForce.ts @@ -0,0 +1,12 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export enum TimeInForce { + Gtc = 0, + Ioc = 1, + Fok = 2, + NonRepresentable = 254 +} diff --git a/binance/generated-typescript/spot_sbe/TradesResponse.ts b/binance/generated-typescript/spot_sbe/TradesResponse.ts new file mode 100644 index 0000000000..1bd2df1580 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/TradesResponse.ts @@ -0,0 +1,123 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Trades { + id: bigint; + price: bigint; + qty: bigint; + quoteQty: bigint; + time: bigint; + isBuyerMaker: number; + isBestMatch: number; +} + +export interface TradesResponse { + priceExponent: number; + qtyExponent: number; + trades: Trades[]; +} + +export class TradesResponseDecoder { + private static readonly BLOCK_LENGTH = 2; + private static readonly TEMPLATE_ID = 201; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): TradesResponse { + const view = new DataView(buffer); + let pos = offset; + + const priceExponent = view.getInt8(pos); + pos += 1; + + const qtyExponent = view.getInt8(pos); + pos += 1; + + // Skip to end of block for forward compatibility + pos = offset + TradesResponseDecoder.BLOCK_LENGTH; + + const trades = this.decodeTradesGroup(view, pos); + pos = trades.nextOffset; + + return { + priceExponent: priceExponent, + qtyExponent: qtyExponent, + trades: trades.items + }; + } + private decodeTradesGroup(view: DataView, offset: number): { items: Trades[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Trades[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const id = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const quoteQty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const time = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const isBuyerMaker = view.getUint8(pos); + pos += 1; + + const isBestMatch = view.getUint8(pos); + pos += 1; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + id: id, + price: price, + qty: qty, + quoteQty: quoteQty, + time: time, + isBuyerMaker: isBuyerMaker, + isBestMatch: isBestMatch + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return TradesResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return TradesResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return TradesResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return TradesResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/TrailingDeltaFilter.ts b/binance/generated-typescript/spot_sbe/TrailingDeltaFilter.ts new file mode 100644 index 0000000000..020903dab9 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/TrailingDeltaFilter.ts @@ -0,0 +1,73 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface TrailingDeltaFilter { + filterType: number; + minTrailingAboveDelta: bigint; + maxTrailingAboveDelta: bigint; + minTrailingBelowDelta: bigint; + maxTrailingBelowDelta: bigint; +} + +export class TrailingDeltaFilterDecoder { + private static readonly BLOCK_LENGTH = 32; + private static readonly TEMPLATE_ID = 13; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): TrailingDeltaFilter { + const view = new DataView(buffer); + let pos = offset; + + const filterType = view.getUint8(pos); + pos += 1; + + const minTrailingAboveDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const maxTrailingAboveDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const minTrailingBelowDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const maxTrailingBelowDelta = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + TrailingDeltaFilterDecoder.BLOCK_LENGTH; + + return { + filterType: filterType, + minTrailingAboveDelta: minTrailingAboveDelta, + maxTrailingAboveDelta: maxTrailingAboveDelta, + minTrailingBelowDelta: minTrailingBelowDelta, + maxTrailingBelowDelta: maxTrailingBelowDelta + }; + } + + static getBlockLength(): number { + return TrailingDeltaFilterDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return TrailingDeltaFilterDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return TrailingDeltaFilterDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return TrailingDeltaFilterDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/UserDataStreamPingResponse.ts b/binance/generated-typescript/spot_sbe/UserDataStreamPingResponse.ts new file mode 100644 index 0000000000..5908a035b2 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/UserDataStreamPingResponse.ts @@ -0,0 +1,48 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface UserDataStreamPingResponse { +} + +export class UserDataStreamPingResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 501; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): UserDataStreamPingResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + UserDataStreamPingResponseDecoder.BLOCK_LENGTH; + + return { + }; + } + + static getBlockLength(): number { + return UserDataStreamPingResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return UserDataStreamPingResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return UserDataStreamPingResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return UserDataStreamPingResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/UserDataStreamStartResponse.ts b/binance/generated-typescript/spot_sbe/UserDataStreamStartResponse.ts new file mode 100644 index 0000000000..3f48855da7 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/UserDataStreamStartResponse.ts @@ -0,0 +1,65 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface UserDataStreamStartResponse { + listenKey: Uint8Array; +} + +export class UserDataStreamStartResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 500; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): UserDataStreamStartResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + UserDataStreamStartResponseDecoder.BLOCK_LENGTH; + + const listenKey = this.decodeVarData(view, pos); + pos = listenKey.nextOffset; + + return { + listenKey: listenKey.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return UserDataStreamStartResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return UserDataStreamStartResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return UserDataStreamStartResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return UserDataStreamStartResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/UserDataStreamStopResponse.ts b/binance/generated-typescript/spot_sbe/UserDataStreamStopResponse.ts new file mode 100644 index 0000000000..d82dd93b8c --- /dev/null +++ b/binance/generated-typescript/spot_sbe/UserDataStreamStopResponse.ts @@ -0,0 +1,48 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface UserDataStreamStopResponse { +} + +export class UserDataStreamStopResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 502; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): UserDataStreamStopResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + UserDataStreamStopResponseDecoder.BLOCK_LENGTH; + + return { + }; + } + + static getBlockLength(): number { + return UserDataStreamStopResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return UserDataStreamStopResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return UserDataStreamStopResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return UserDataStreamStopResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/UserDataStreamSubscribeListenTokenResponse.ts b/binance/generated-typescript/spot_sbe/UserDataStreamSubscribeListenTokenResponse.ts new file mode 100644 index 0000000000..dcdbba95cf --- /dev/null +++ b/binance/generated-typescript/spot_sbe/UserDataStreamSubscribeListenTokenResponse.ts @@ -0,0 +1,58 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface UserDataStreamSubscribeListenTokenResponse { + subscriptionId: number; + expirationTime: bigint; +} + +export class UserDataStreamSubscribeListenTokenResponseDecoder { + private static readonly BLOCK_LENGTH = 10; + private static readonly TEMPLATE_ID = 505; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): UserDataStreamSubscribeListenTokenResponse { + const view = new DataView(buffer); + let pos = offset; + + const subscriptionId = view.getUint16(pos, this.littleEndian); + pos += 2; + + const expirationTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = offset + UserDataStreamSubscribeListenTokenResponseDecoder.BLOCK_LENGTH; + + return { + subscriptionId: subscriptionId, + expirationTime: expirationTime + }; + } + + static getBlockLength(): number { + return UserDataStreamSubscribeListenTokenResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return UserDataStreamSubscribeListenTokenResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return UserDataStreamSubscribeListenTokenResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return UserDataStreamSubscribeListenTokenResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/UserDataStreamSubscribeResponse.ts b/binance/generated-typescript/spot_sbe/UserDataStreamSubscribeResponse.ts new file mode 100644 index 0000000000..b9fa71f9ee --- /dev/null +++ b/binance/generated-typescript/spot_sbe/UserDataStreamSubscribeResponse.ts @@ -0,0 +1,53 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface UserDataStreamSubscribeResponse { + subscriptionId: number; +} + +export class UserDataStreamSubscribeResponseDecoder { + private static readonly BLOCK_LENGTH = 2; + private static readonly TEMPLATE_ID = 503; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): UserDataStreamSubscribeResponse { + const view = new DataView(buffer); + let pos = offset; + + const subscriptionId = view.getUint16(pos, this.littleEndian); + pos += 2; + + // Skip to end of block for forward compatibility + pos = offset + UserDataStreamSubscribeResponseDecoder.BLOCK_LENGTH; + + return { + subscriptionId: subscriptionId + }; + } + + static getBlockLength(): number { + return UserDataStreamSubscribeResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return UserDataStreamSubscribeResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return UserDataStreamSubscribeResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return UserDataStreamSubscribeResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/UserDataStreamUnsubscribeResponse.ts b/binance/generated-typescript/spot_sbe/UserDataStreamUnsubscribeResponse.ts new file mode 100644 index 0000000000..c27da32f91 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/UserDataStreamUnsubscribeResponse.ts @@ -0,0 +1,48 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface UserDataStreamUnsubscribeResponse { +} + +export class UserDataStreamUnsubscribeResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 504; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): UserDataStreamUnsubscribeResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + UserDataStreamUnsubscribeResponseDecoder.BLOCK_LENGTH; + + return { + }; + } + + static getBlockLength(): number { + return UserDataStreamUnsubscribeResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return UserDataStreamUnsubscribeResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return UserDataStreamUnsubscribeResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return UserDataStreamUnsubscribeResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/VarString.ts b/binance/generated-typescript/spot_sbe/VarString.ts new file mode 100644 index 0000000000..e216b684c5 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/VarString.ts @@ -0,0 +1,33 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface VarString { + length: number; + varData: number; +} + +export class VarStringDecoder { + private static readonly ENCODED_LENGTH = -1; + + static decode(view: DataView, offset: number, littleEndian: boolean): VarString { + let pos = offset; + + const length = view.getUint16(pos, littleEndian); + pos += 2; + + const varData = view.getUint8(pos); + pos += -1; + + return { + length: length, + varData: varData + }; + } + + static getEncodedLength(): number { + return VarStringDecoder.ENCODED_LENGTH; + } +} diff --git a/binance/generated-typescript/spot_sbe/VarString8.ts b/binance/generated-typescript/spot_sbe/VarString8.ts new file mode 100644 index 0000000000..e7f25b580a --- /dev/null +++ b/binance/generated-typescript/spot_sbe/VarString8.ts @@ -0,0 +1,33 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface VarString8 { + length: number; + varData: number; +} + +export class VarString8Decoder { + private static readonly ENCODED_LENGTH = -1; + + static decode(view: DataView, offset: number, littleEndian: boolean): VarString8 { + let pos = offset; + + const length = view.getUint8(pos); + pos += 1; + + const varData = view.getUint8(pos); + pos += -1; + + return { + length: length, + varData: varData + }; + } + + static getEncodedLength(): number { + return VarString8Decoder.ENCODED_LENGTH; + } +} diff --git a/binance/generated-typescript/spot_sbe/WebSocketResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketResponse.ts new file mode 100644 index 0000000000..5c4e500e90 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/WebSocketResponse.ts @@ -0,0 +1,135 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface RateLimits { + rateLimitType: number; + interval: number; + intervalNum: number; + rateLimit: bigint; + current: bigint; +} + +export interface WebSocketResponse { + sbeSchemaIdVersionDeprecated: number; + status: number; + rateLimits: RateLimits[]; + id: Uint8Array; + result: Uint8Array; +} + +export class WebSocketResponseDecoder { + private static readonly BLOCK_LENGTH = 3; + private static readonly TEMPLATE_ID = 50; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): WebSocketResponse { + const view = new DataView(buffer); + let pos = offset; + + const sbeSchemaIdVersionDeprecated = view.getUint8(pos); + pos += 1; + + const status = view.getUint16(pos, this.littleEndian); + pos += 2; + + // Skip to end of block for forward compatibility + pos = offset + WebSocketResponseDecoder.BLOCK_LENGTH; + + const rateLimits = this.decodeRateLimitsGroup(view, pos); + pos = rateLimits.nextOffset; + + const id = this.decodeVarData(view, pos); + pos = id.nextOffset; + + const result = this.decodeVarData(view, pos); + pos = result.nextOffset; + + return { + sbeSchemaIdVersionDeprecated: sbeSchemaIdVersionDeprecated, + status: status, + rateLimits: rateLimits.items, + id: id.value, + result: result.value + }; + } + private decodeRateLimitsGroup(view: DataView, offset: number): { items: RateLimits[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: RateLimits[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const rateLimitType = view.getUint8(pos); + pos += 1; + + const interval = view.getUint8(pos); + pos += 1; + + const intervalNum = view.getUint8(pos); + pos += 1; + + const rateLimit = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const current = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + rateLimitType: rateLimitType, + interval: interval, + intervalNum: intervalNum, + rateLimit: rateLimit, + current: current + }); + } + + return { items, nextOffset: pos }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return WebSocketResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return WebSocketResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return WebSocketResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return WebSocketResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/WebSocketSessionLogonResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketSessionLogonResponse.ts new file mode 100644 index 0000000000..9c110de82c --- /dev/null +++ b/binance/generated-typescript/spot_sbe/WebSocketSessionLogonResponse.ts @@ -0,0 +1,90 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface WebSocketSessionLogonResponse { + authorizedSince: bigint; + connectedSince: bigint; + returnRateLimits: number; + serverTime: bigint; + userDataStream: number; + loggedOnApiKey: Uint8Array; +} + +export class WebSocketSessionLogonResponseDecoder { + private static readonly BLOCK_LENGTH = 26; + private static readonly TEMPLATE_ID = 51; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): WebSocketSessionLogonResponse { + const view = new DataView(buffer); + let pos = offset; + + const authorizedSince = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const connectedSince = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const returnRateLimits = view.getUint8(pos); + pos += 1; + + const serverTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const userDataStream = view.getUint8(pos); + pos += 1; + + // Skip to end of block for forward compatibility + pos = offset + WebSocketSessionLogonResponseDecoder.BLOCK_LENGTH; + + const loggedOnApiKey = this.decodeVarData(view, pos); + pos = loggedOnApiKey.nextOffset; + + return { + authorizedSince: authorizedSince, + connectedSince: connectedSince, + returnRateLimits: returnRateLimits, + serverTime: serverTime, + userDataStream: userDataStream, + loggedOnApiKey: loggedOnApiKey.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return WebSocketSessionLogonResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return WebSocketSessionLogonResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return WebSocketSessionLogonResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return WebSocketSessionLogonResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/WebSocketSessionLogoutResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketSessionLogoutResponse.ts new file mode 100644 index 0000000000..566f0f52ad --- /dev/null +++ b/binance/generated-typescript/spot_sbe/WebSocketSessionLogoutResponse.ts @@ -0,0 +1,90 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface WebSocketSessionLogoutResponse { + authorizedSince: bigint; + connectedSince: bigint; + returnRateLimits: number; + serverTime: bigint; + userDataStream: number; + loggedOnApiKey: Uint8Array; +} + +export class WebSocketSessionLogoutResponseDecoder { + private static readonly BLOCK_LENGTH = 26; + private static readonly TEMPLATE_ID = 53; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): WebSocketSessionLogoutResponse { + const view = new DataView(buffer); + let pos = offset; + + const authorizedSince = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const connectedSince = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const returnRateLimits = view.getUint8(pos); + pos += 1; + + const serverTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const userDataStream = view.getUint8(pos); + pos += 1; + + // Skip to end of block for forward compatibility + pos = offset + WebSocketSessionLogoutResponseDecoder.BLOCK_LENGTH; + + const loggedOnApiKey = this.decodeVarData(view, pos); + pos = loggedOnApiKey.nextOffset; + + return { + authorizedSince: authorizedSince, + connectedSince: connectedSince, + returnRateLimits: returnRateLimits, + serverTime: serverTime, + userDataStream: userDataStream, + loggedOnApiKey: loggedOnApiKey.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return WebSocketSessionLogoutResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return WebSocketSessionLogoutResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return WebSocketSessionLogoutResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return WebSocketSessionLogoutResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/WebSocketSessionStatusResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketSessionStatusResponse.ts new file mode 100644 index 0000000000..224cdc8595 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/WebSocketSessionStatusResponse.ts @@ -0,0 +1,90 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface WebSocketSessionStatusResponse { + authorizedSince: bigint; + connectedSince: bigint; + returnRateLimits: number; + serverTime: bigint; + userDataStream: number; + loggedOnApiKey: Uint8Array; +} + +export class WebSocketSessionStatusResponseDecoder { + private static readonly BLOCK_LENGTH = 26; + private static readonly TEMPLATE_ID = 52; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): WebSocketSessionStatusResponse { + const view = new DataView(buffer); + let pos = offset; + + const authorizedSince = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const connectedSince = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const returnRateLimits = view.getUint8(pos); + pos += 1; + + const serverTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const userDataStream = view.getUint8(pos); + pos += 1; + + // Skip to end of block for forward compatibility + pos = offset + WebSocketSessionStatusResponseDecoder.BLOCK_LENGTH; + + const loggedOnApiKey = this.decodeVarData(view, pos); + pos = loggedOnApiKey.nextOffset; + + return { + authorizedSince: authorizedSince, + connectedSince: connectedSince, + returnRateLimits: returnRateLimits, + serverTime: serverTime, + userDataStream: userDataStream, + loggedOnApiKey: loggedOnApiKey.value + }; + } + + private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + let pos = offset; + + const length = view.getUint32(pos, this.littleEndian); + pos += 4; + + const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); + pos += length; + + return { value, nextOffset: pos }; + } + + static getBlockLength(): number { + return WebSocketSessionStatusResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return WebSocketSessionStatusResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return WebSocketSessionStatusResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return WebSocketSessionStatusResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/WebSocketSessionSubscriptionsResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketSessionSubscriptionsResponse.ts new file mode 100644 index 0000000000..0eee21185e --- /dev/null +++ b/binance/generated-typescript/spot_sbe/WebSocketSessionSubscriptionsResponse.ts @@ -0,0 +1,88 @@ +/** + * Auto-generated by SBE (Simple Binary Encoding) + * Schema: spot_sbe + * DO NOT EDIT + */ + +export interface Subscriptions { + subscriptionId: number; + expirationTime: bigint; +} + +export interface WebSocketSessionSubscriptionsResponse { + subscriptions: Subscriptions[]; +} + +export class WebSocketSessionSubscriptionsResponseDecoder { + private static readonly BLOCK_LENGTH = 0; + private static readonly TEMPLATE_ID = 54; + private static readonly SCHEMA_ID = 3; + private static readonly SCHEMA_VERSION = 2; + + private readonly littleEndian: boolean; + + constructor(byteOrder: 'little' | 'big' = 'little') { + this.littleEndian = byteOrder === 'little'; + } + + decode(buffer: ArrayBuffer, offset: number = 0): WebSocketSessionSubscriptionsResponse { + const view = new DataView(buffer); + let pos = offset; + + // Skip to end of block for forward compatibility + pos = offset + WebSocketSessionSubscriptionsResponseDecoder.BLOCK_LENGTH; + + const subscriptions = this.decodeSubscriptionsGroup(view, pos); + pos = subscriptions.nextOffset; + + return { + subscriptions: subscriptions.items + }; + } + private decodeSubscriptionsGroup(view: DataView, offset: number): { items: Subscriptions[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Subscriptions[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const subscriptionId = view.getUint16(pos, this.littleEndian); + pos += 2; + + const expirationTime = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to next block for forward compatibility + pos = itemStart + blockLength; + + items.push({ + subscriptionId: subscriptionId, + expirationTime: expirationTime + }); + } + + return { items, nextOffset: pos }; + } + + static getBlockLength(): number { + return WebSocketSessionSubscriptionsResponseDecoder.BLOCK_LENGTH; + } + + static getTemplateId(): number { + return WebSocketSessionSubscriptionsResponseDecoder.TEMPLATE_ID; + } + + static getSchemaId(): number { + return WebSocketSessionSubscriptionsResponseDecoder.SCHEMA_ID; + } + + static getSchemaVersion(): number { + return WebSocketSessionSubscriptionsResponseDecoder.SCHEMA_VERSION; + } +} diff --git a/binance/generated-typescript/spot_sbe/index.ts b/binance/generated-typescript/spot_sbe/index.ts new file mode 100644 index 0000000000..0cc6b00687 --- /dev/null +++ b/binance/generated-typescript/spot_sbe/index.ts @@ -0,0 +1,128 @@ +/** + * Barrel export file for all generated SBE types + * Auto-generated - DO NOT EDIT + */ + +export * from './OrderType'; +export * from './VarString'; +export * from './MatchType'; +export * from './ExecutionType'; +export * from './BoolEnum'; +export * from './OrderStatus'; +export * from './GroupSizeEncoding'; +export * from './PegPriceType'; +export * from './GroupSize16Encoding'; +export * from './OptionalMessageData'; +export * from './ContingencyType'; +export * from './ListOrderStatus'; +export * from './MessageData8'; +export * from './RateLimitInterval'; +export * from './Floor'; +export * from './TimeInForce'; +export * from './ListStatusType'; +export * from './AllowedSelfTradePreventionModes'; +export * from './MessageHeader'; +export * from './AccountType'; +export * from './OptionalMessageData16'; +export * from './OrderCapacity'; +export * from './AllocationType'; +export * from './OptionalVarString'; +export * from './OrderSide'; +export * from './OrderTypes'; +export * from './SelfTradePreventionMode'; +export * from './CancelReplaceStatus'; +export * from './SymbolStatus'; +export * from './OptionalVarString8'; +export * from './RateLimitType'; +export * from './MessageData16'; +export * from './FilterType'; +export * from './PegOffsetType'; +export * from './VarString8'; +export * from './MessageData'; +export * from './MessageHeader'; +export * from './PriceFilter'; +export * from './PercentPriceFilter'; +export * from './PercentPriceBySideFilter'; +export * from './LotSizeFilter'; +export * from './MinNotionalFilter'; +export * from './NotionalFilter'; +export * from './IcebergPartsFilter'; +export * from './MarketLotSizeFilter'; +export * from './MaxNumOrdersFilter'; +export * from './MaxNumAlgoOrdersFilter'; +export * from './MaxNumIcebergOrdersFilter'; +export * from './MaxPositionFilter'; +export * from './TrailingDeltaFilter'; +export * from './TPlusSellFilter'; +export * from './ExchangeMaxNumOrdersFilter'; +export * from './ExchangeMaxNumAlgoOrdersFilter'; +export * from './AccountResponse'; +export * from './ExchangeMaxNumIcebergOrdersFilter'; +export * from './AccountTradesResponse'; +export * from './MaxNumOrderListsFilter'; +export * from './AccountOrderRateLimitResponse'; +export * from './ExchangeMaxNumOrderListsFilter'; +export * from './AccountPreventedMatchesResponse'; +export * from './MaxNumOrderAmendsFilter'; +export * from './AccountAllocationsResponse'; +export * from './MaxAssetFilter'; +export * from './AccountCommissionResponse'; +export * from './NewOrderAckResponse'; +export * from './NewOrderResultResponse'; +export * from './NewOrderFullResponse'; +export * from './OrderTestResponse'; +export * from './OrderResponse'; +export * from './CancelOrderResponse'; +export * from './WebSocketResponse'; +export * from './CancelOpenOrdersResponse'; +export * from './WebSocketSessionLogonResponse'; +export * from './CancelReplaceOrderResponse'; +export * from './WebSocketSessionStatusResponse'; +export * from './OrdersResponse'; +export * from './WebSocketSessionLogoutResponse'; +export * from './NewOrderListAckResponse'; +export * from './WebSocketSessionSubscriptionsResponse'; +export * from './NewOrderListResultResponse'; +export * from './NewOrderListFullResponse'; +export * from './CancelOrderListResponse'; +export * from './OrderListResponse'; +export * from './OrderListsResponse'; +export * from './OrderTestWithCommissionsResponse'; +export * from './OrderAmendmentsResponse'; +export * from './OrderAmendKeepPriorityResponse'; +export * from './DepthResponse'; +export * from './TradesResponse'; +export * from './AggTradesResponse'; +export * from './KlinesResponse'; +export * from './AveragePriceResponse'; +export * from './Ticker24hSymbolFullResponse'; +export * from './Ticker24hFullResponse'; +export * from './Ticker24hSymbolMiniResponse'; +export * from './Ticker24hMiniResponse'; +export * from './PriceTickerSymbolResponse'; +export * from './PriceTickerResponse'; +export * from './BookTickerSymbolResponse'; +export * from './BookTickerResponse'; +export * from './TickerSymbolFullResponse'; +export * from './TickerFullResponse'; +export * from './TickerSymbolMiniResponse'; +export * from './TickerMiniResponse'; +export * from './BalanceUpdateEvent'; +export * from './EventStreamTerminatedEvent'; +export * from './ExecutionReportEvent'; +export * from './ExternalLockUpdateEvent'; +export * from './ListStatusEvent'; +export * from './OutboundAccountPositionEvent'; +export * from './TPlusFilterLockEvent'; +export * from './ErrorResponse'; +export * from './PingResponse'; +export * from './ServerTimeResponse'; +export * from './ExchangeInfoResponse'; +export * from './NonRepresentableMessage'; +export * from './MyFiltersResponse'; +export * from './UserDataStreamStartResponse'; +export * from './UserDataStreamPingResponse'; +export * from './UserDataStreamStopResponse'; +export * from './UserDataStreamSubscribeResponse'; +export * from './UserDataStreamUnsubscribeResponse'; +export * from './UserDataStreamSubscribeListenTokenResponse'; diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java index 0844bcd977..4bd0362866 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java @@ -117,7 +117,8 @@ private void generateMessageHeaderStub() throws IOException final StringBuilder sb = new StringBuilder(); sb.append(generateFileHeader(ir.packageName())); - generateCompositeDecoder(sb, typeName, tokens.subList(1, tokens.size() - 1)); + generateCompositeDecoder(sb, typeName, tokens.subList(1, tokens.size() - 1), + tokens.get(0).encodedLength()); out.append(sb); } @@ -258,7 +259,8 @@ private void generateComposite(final List tokens) throws IOException final StringBuilder sb = new StringBuilder(); sb.append(generateFileHeader(ir.packageName())); - generateCompositeDecoder(sb, compositeName, tokens.subList(1, tokens.size() - 1)); + generateCompositeDecoder(sb, compositeName, tokens.subList(1, tokens.size() - 1), + compositeToken.encodedLength()); out.append(sb); } @@ -274,7 +276,8 @@ private void generateComposite(final List tokens) throws IOException private void generateCompositeDecoder( final StringBuilder sb, final String name, - final List tokens) + final List tokens, + final int encodedLength) { final String interfaceName = name; final String decoderName = name + "Decoder"; @@ -282,23 +285,26 @@ private void generateCompositeDecoder( // Generate interface sb.append("export interface ").append(interfaceName).append(" {\n"); - Generators.forEachField(tokens, (fieldToken, typeToken) -> + for (int i = 0; i < tokens.size(); i++) { - final String fieldName = formatFieldName(fieldToken.name()); - final String typeName = typeScriptTypeName(typeToken.encoding().primitiveType()); - final boolean isConstant = typeToken.isConstantEncoding(); - - if (isConstant) - { - sb.append(" readonly "); - } - else + final Token token = tokens.get(i); + if (token.signal() == Signal.ENCODING) { - sb.append(" "); - } + final String fieldName = formatFieldName(token.name()); + final String typeName = typeScriptTypeName(token.encoding().primitiveType()); - sb.append(fieldName).append(": ").append(typeName).append(";\n"); - }); + if (token.isConstantEncoding()) + { + sb.append(" readonly "); + } + else + { + sb.append(" "); + } + + sb.append(fieldName).append(": ").append(typeName).append(";\n"); + } + } sb.append("}\n\n"); @@ -306,22 +312,23 @@ private void generateCompositeDecoder( sb.append("export class ").append(decoderName).append(" {\n"); // Add constants - Generators.forEachField(tokens, (fieldToken, typeToken) -> + for (int i = 0; i < tokens.size(); i++) { - if (typeToken.isConstantEncoding()) + final Token token = tokens.get(i); + if (token.signal() == Signal.ENCODING && token.isConstantEncoding()) { - final String constantName = formatConstantName(fieldToken.name()); + final String constantName = formatConstantName(token.name()); final String value = generateLiteral( - typeToken.encoding().primitiveType(), - typeToken.encoding().constValue().toString()); + token.encoding().primitiveType(), + token.encoding().constValue().toString()); sb.append(" private static readonly ").append(constantName) .append(" = ").append(value).append(";\n"); } - }); + } sb.append(" private static readonly ENCODED_LENGTH = ") - .append(tokens.get(0).encodedLength()).append(";\n\n"); + .append(encodedLength).append(";\n\n"); // Generate decode method sb.append(" static decode(view: DataView, offset: number, littleEndian: boolean): ") @@ -331,37 +338,39 @@ private void generateCompositeDecoder( final List fieldNames = new ArrayList<>(); final List fieldValues = new ArrayList<>(); - Generators.forEachField(tokens, (fieldToken, typeToken) -> + for (int i = 0; i < tokens.size(); i++) { - final String fieldName = formatFieldName(fieldToken.name()); - fieldNames.add(fieldName); - - if (typeToken.isConstantEncoding()) + final Token token = tokens.get(i); + if (token.signal() == Signal.ENCODING) { - // Constant field - not read from buffer - final String constantName = formatConstantName(fieldToken.name()); - fieldValues.add(decoderName + "." + constantName); - } - else - { - // Regular field - read from buffer - final PrimitiveType primitiveType = typeToken.encoding().primitiveType(); - final String dataViewMethod = dataViewMethod(primitiveType); - - sb.append(" const ").append(fieldName).append(" = view.") - .append(dataViewMethod).append("(pos"); + final String fieldName = formatFieldName(token.name()); + fieldNames.add(fieldName); - if (needsEndianness(primitiveType)) + if (token.isConstantEncoding()) { - sb.append(", littleEndian"); + final String constantName = formatConstantName(token.name()); + fieldValues.add(decoderName + "." + constantName); } + else + { + final PrimitiveType primitiveType = token.encoding().primitiveType(); + final String dataViewMethod = dataViewMethod(primitiveType); - sb.append(");\n"); - sb.append(" pos += ").append(typeToken.encodedLength()).append(";\n\n"); + sb.append(" const ").append(fieldName).append(" = view.") + .append(dataViewMethod).append("(pos"); - fieldValues.add(fieldName); + if (needsEndianness(primitiveType)) + { + sb.append(", littleEndian"); + } + + sb.append(");\n"); + sb.append(" pos += ").append(token.encodedLength()).append(";\n\n"); + + fieldValues.add(fieldName); + } } - }); + } sb.append(" return {\n"); for (int i = 0; i < fieldNames.size(); i++) From be5e241b027332e9a19d32cc5bca57a9d07fa7a4 Mon Sep 17 00:00:00 2001 From: Pablo Date: Sat, 7 Mar 2026 13:58:52 -0500 Subject: [PATCH 10/11] Fix TypeScript nested groups, vardata in groups, and vardata length type Three fixes to the TypeScript code generator: 1. Nested groups and vardata inside groups were silently dropped. generateGroupInterfaces() and generateGroupDecoderMethods() only used Generators.forEachField() which skips BEGIN_GROUP and BEGIN_VAR_DATA tokens. Rewrote both to use collectFields/collectGroups/collectVarData on the group body with recursive handling of nested groups, matching the pattern used by the Go generator. 2. Var data length type was hardcoded as uint32. Replaced shared helper methods (decodeVarData, decodeVarStringUtf8, decodeVarStringAscii) with inline decode that reads the actual length type from schema tokens via Generators.findFirst("length", ...). 3. Message interface character encoding detection used the BEGIN_VAR_DATA token which doesn't carry characterEncoding. Changed to use Generators.findFirst("varData", ...) to read from the inner composite token, fixing type mismatches (e.g. ErrorResponse.msg was Uint8Array, now correctly string). --- .../spot_sbe/AccountAllocationsResponse.ts | 25 +- .../spot_sbe/AccountCommissionResponse.ts | 32 +- .../spot_sbe/AccountOrderRateLimitResponse.ts | 2 +- .../AccountPreventedMatchesResponse.ts | 18 +- .../spot_sbe/AccountResponse.ts | 29 +- .../spot_sbe/AccountTradesResponse.ts | 18 +- .../spot_sbe/AggTradesResponse.ts | 2 +- .../spot_sbe/BalanceUpdateEvent.ts | 22 +- .../spot_sbe/BookTickerResponse.ts | 11 +- .../spot_sbe/BookTickerSymbolResponse.ts | 22 +- .../spot_sbe/CancelOpenOrdersResponse.ts | 9 +- .../spot_sbe/CancelOrderListResponse.ts | 75 ++-- .../spot_sbe/CancelOrderResponse.ts | 42 +-- .../spot_sbe/CancelReplaceOrderResponse.ts | 28 +- .../spot_sbe/DepthResponse.ts | 4 +- .../spot_sbe/ErrorResponse.ts | 30 +- .../spot_sbe/ExchangeInfoResponse.ts | 186 +++++++++- .../spot_sbe/ExecutionReportEvent.ts | 72 ++-- .../spot_sbe/ExternalLockUpdateEvent.ts | 22 +- .../spot_sbe/KlinesResponse.ts | 2 +- .../spot_sbe/ListStatusEvent.ts | 60 ++-- .../spot_sbe/MaxAssetFilter.ts | 22 +- .../spot_sbe/MyFiltersResponse.ts | 27 +- .../spot_sbe/NewOrderAckResponse.ts | 32 +- .../spot_sbe/NewOrderFullResponse.ts | 54 +-- .../spot_sbe/NewOrderListAckResponse.ts | 68 ++-- .../spot_sbe/NewOrderListFullResponse.ts | 224 ++++++++---- .../spot_sbe/NewOrderListResultResponse.ts | 68 ++-- .../spot_sbe/NewOrderResultResponse.ts | 32 +- .../OrderAmendKeepPriorityResponse.ts | 130 +++++-- .../spot_sbe/OrderAmendmentsResponse.ts | 25 +- .../spot_sbe/OrderListResponse.ts | 50 +-- .../spot_sbe/OrderListsResponse.ts | 70 +++- .../spot_sbe/OrderResponse.ts | 32 +- .../OrderTestWithCommissionsResponse.ts | 22 +- .../spot_sbe/OrdersResponse.ts | 18 +- .../spot_sbe/OutboundAccountPositionEvent.ts | 11 +- .../spot_sbe/PriceTickerResponse.ts | 11 +- .../spot_sbe/PriceTickerSymbolResponse.ts | 22 +- .../spot_sbe/TPlusFilterLockEvent.ts | 34 +- .../spot_sbe/Ticker24hFullResponse.ts | 11 +- .../spot_sbe/Ticker24hMiniResponse.ts | 11 +- .../spot_sbe/Ticker24hSymbolFullResponse.ts | 22 +- .../spot_sbe/Ticker24hSymbolMiniResponse.ts | 22 +- .../spot_sbe/TickerFullResponse.ts | 11 +- .../spot_sbe/TickerMiniResponse.ts | 11 +- .../spot_sbe/TickerSymbolFullResponse.ts | 22 +- .../spot_sbe/TickerSymbolMiniResponse.ts | 22 +- .../spot_sbe/TradesResponse.ts | 2 +- .../spot_sbe/UserDataStreamStartResponse.ts | 22 +- .../spot_sbe/WebSocketResponse.ts | 32 +- .../spot_sbe/WebSocketSessionLogonResponse.ts | 22 +- .../WebSocketSessionLogoutResponse.ts | 22 +- .../WebSocketSessionStatusResponse.ts | 22 +- .../WebSocketSessionSubscriptionsResponse.ts | 2 +- .../typescript/TypeScriptGenerator.java | 333 ++++++++++-------- 56 files changed, 1382 insertions(+), 870 deletions(-) diff --git a/binance/generated-typescript/spot_sbe/AccountAllocationsResponse.ts b/binance/generated-typescript/spot_sbe/AccountAllocationsResponse.ts index d5fae5b13c..1cec71c90c 100644 --- a/binance/generated-typescript/spot_sbe/AccountAllocationsResponse.ts +++ b/binance/generated-typescript/spot_sbe/AccountAllocationsResponse.ts @@ -22,6 +22,9 @@ export interface Allocations { isBuyer: number; isMaker: number; isAllocator: number; + symbol: string; + commissionAsset: string; + sourceSymbol: string; } export interface AccountAllocationsResponse { @@ -118,9 +121,24 @@ export class AccountAllocationsResponseDecoder { const isAllocator = view.getUint8(pos); pos += 1; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const commissionAssetLen = view.getUint8(pos); + pos += 1; + const commissionAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, commissionAssetLen)); + pos += commissionAssetLen; + + const sourceSymbolLen = view.getUint8(pos); + pos += 1; + const sourceSymbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, sourceSymbolLen)); + pos += sourceSymbolLen; + items.push({ priceExponent: priceExponent, qtyExponent: qtyExponent, @@ -138,7 +156,10 @@ export class AccountAllocationsResponseDecoder { time: time, isBuyer: isBuyer, isMaker: isMaker, - isAllocator: isAllocator + isAllocator: isAllocator, + symbol: symbol, + commissionAsset: commissionAsset, + sourceSymbol: sourceSymbol }); } diff --git a/binance/generated-typescript/spot_sbe/AccountCommissionResponse.ts b/binance/generated-typescript/spot_sbe/AccountCommissionResponse.ts index dc52e1024d..b9c0bd2d2b 100644 --- a/binance/generated-typescript/spot_sbe/AccountCommissionResponse.ts +++ b/binance/generated-typescript/spot_sbe/AccountCommissionResponse.ts @@ -22,8 +22,8 @@ export interface AccountCommissionResponse { specialCommissionTaker: bigint; specialCommissionBuyer: bigint; specialCommissionSeller: bigint; - symbol: Uint8Array; - discountAsset: Uint8Array; + symbol: string; + discountAsset: string; } export class AccountCommissionResponseDecoder { @@ -96,11 +96,15 @@ export class AccountCommissionResponseDecoder { // Skip to end of block for forward compatibility pos = offset + AccountCommissionResponseDecoder.BLOCK_LENGTH; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; - const discountAsset = this.decodeVarData(view, pos); - pos = discountAsset.nextOffset; + const discountAssetLen = view.getUint8(pos); + pos += 1; + const discountAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, discountAssetLen)); + pos += discountAssetLen; return { commissionExponent: commissionExponent, @@ -120,23 +124,11 @@ export class AccountCommissionResponseDecoder { specialCommissionTaker: specialCommissionTaker, specialCommissionBuyer: specialCommissionBuyer, specialCommissionSeller: specialCommissionSeller, - symbol: symbol.value, - discountAsset: discountAsset.value + symbol: symbol, + discountAsset: discountAsset }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return AccountCommissionResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/AccountOrderRateLimitResponse.ts b/binance/generated-typescript/spot_sbe/AccountOrderRateLimitResponse.ts index e5fcbccfdd..a67f354350 100644 --- a/binance/generated-typescript/spot_sbe/AccountOrderRateLimitResponse.ts +++ b/binance/generated-typescript/spot_sbe/AccountOrderRateLimitResponse.ts @@ -70,7 +70,7 @@ export class AccountOrderRateLimitResponseDecoder { const numOrders = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; items.push({ diff --git a/binance/generated-typescript/spot_sbe/AccountPreventedMatchesResponse.ts b/binance/generated-typescript/spot_sbe/AccountPreventedMatchesResponse.ts index c001c7bec4..46774fa0b1 100644 --- a/binance/generated-typescript/spot_sbe/AccountPreventedMatchesResponse.ts +++ b/binance/generated-typescript/spot_sbe/AccountPreventedMatchesResponse.ts @@ -16,6 +16,8 @@ export interface PreventedMatches { takerPreventedQuantity: bigint; makerPreventedQuantity: bigint; transactTime: bigint; + symbol: string; + makerSymbol: string; } export interface AccountPreventedMatchesResponse { @@ -94,9 +96,19 @@ export class AccountPreventedMatchesResponseDecoder { const transactTime = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const makerSymbolLen = view.getUint8(pos); + pos += 1; + const makerSymbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, makerSymbolLen)); + pos += makerSymbolLen; + items.push({ priceExponent: priceExponent, qtyExponent: qtyExponent, @@ -108,7 +120,9 @@ export class AccountPreventedMatchesResponseDecoder { price: price, takerPreventedQuantity: takerPreventedQuantity, makerPreventedQuantity: makerPreventedQuantity, - transactTime: transactTime + transactTime: transactTime, + symbol: symbol, + makerSymbol: makerSymbol }); } diff --git a/binance/generated-typescript/spot_sbe/AccountResponse.ts b/binance/generated-typescript/spot_sbe/AccountResponse.ts index 625c03ea64..0441ee80af 100644 --- a/binance/generated-typescript/spot_sbe/AccountResponse.ts +++ b/binance/generated-typescript/spot_sbe/AccountResponse.ts @@ -8,12 +8,15 @@ export interface Balances { exponent: number; free: bigint; locked: bigint; + asset: string; } export interface Permissions { + permission: string; } export interface ReduceOnlyAssets { + asset: string; } export interface AccountResponse { @@ -153,13 +156,19 @@ export class AccountResponseDecoder { const locked = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const assetLen = view.getUint8(pos); + pos += 1; + const asset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, assetLen)); + pos += assetLen; + items.push({ exponent: exponent, free: free, - locked: locked + locked: locked, + asset: asset }); } @@ -178,10 +187,16 @@ export class AccountResponseDecoder { for (let i = 0; i < numInGroup; i++) { const itemStart = pos; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const permissionLen = view.getUint8(pos); + pos += 1; + const permission = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, permissionLen)); + pos += permissionLen; + items.push({ + permission: permission }); } @@ -200,10 +215,16 @@ export class AccountResponseDecoder { for (let i = 0; i < numInGroup; i++) { const itemStart = pos; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const assetLen = view.getUint8(pos); + pos += 1; + const asset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, assetLen)); + pos += assetLen; + items.push({ + asset: asset }); } diff --git a/binance/generated-typescript/spot_sbe/AccountTradesResponse.ts b/binance/generated-typescript/spot_sbe/AccountTradesResponse.ts index 968be5c08f..1b7770d785 100644 --- a/binance/generated-typescript/spot_sbe/AccountTradesResponse.ts +++ b/binance/generated-typescript/spot_sbe/AccountTradesResponse.ts @@ -19,6 +19,8 @@ export interface Trades { isBuyer: number; isMaker: number; isBestMatch: number; + symbol: string; + commissionAsset: string; } export interface AccountTradesResponse { @@ -106,9 +108,19 @@ export class AccountTradesResponseDecoder { const isBestMatch = view.getUint8(pos); pos += 1; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const commissionAssetLen = view.getUint8(pos); + pos += 1; + const commissionAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, commissionAssetLen)); + pos += commissionAssetLen; + items.push({ priceExponent: priceExponent, qtyExponent: qtyExponent, @@ -123,7 +135,9 @@ export class AccountTradesResponseDecoder { time: time, isBuyer: isBuyer, isMaker: isMaker, - isBestMatch: isBestMatch + isBestMatch: isBestMatch, + symbol: symbol, + commissionAsset: commissionAsset }); } diff --git a/binance/generated-typescript/spot_sbe/AggTradesResponse.ts b/binance/generated-typescript/spot_sbe/AggTradesResponse.ts index 3f7397a340..9d8723f9bc 100644 --- a/binance/generated-typescript/spot_sbe/AggTradesResponse.ts +++ b/binance/generated-typescript/spot_sbe/AggTradesResponse.ts @@ -92,7 +92,7 @@ export class AggTradesResponseDecoder { const isBestMatch = view.getUint8(pos); pos += 1; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; items.push({ diff --git a/binance/generated-typescript/spot_sbe/BalanceUpdateEvent.ts b/binance/generated-typescript/spot_sbe/BalanceUpdateEvent.ts index 642efaa83a..0ec8bad6c1 100644 --- a/binance/generated-typescript/spot_sbe/BalanceUpdateEvent.ts +++ b/binance/generated-typescript/spot_sbe/BalanceUpdateEvent.ts @@ -10,7 +10,7 @@ export interface BalanceUpdateEvent { qtyExponent: number; freeQtyDelta: bigint; subscriptionId: number; - asset: Uint8Array; + asset: string; } export class BalanceUpdateEventDecoder { @@ -47,8 +47,10 @@ export class BalanceUpdateEventDecoder { // Skip to end of block for forward compatibility pos = offset + BalanceUpdateEventDecoder.BLOCK_LENGTH; - const asset = this.decodeVarData(view, pos); - pos = asset.nextOffset; + const assetLen = view.getUint8(pos); + pos += 1; + const asset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, assetLen)); + pos += assetLen; return { eventTime: eventTime, @@ -56,22 +58,10 @@ export class BalanceUpdateEventDecoder { qtyExponent: qtyExponent, freeQtyDelta: freeQtyDelta, subscriptionId: subscriptionId, - asset: asset.value + asset: asset }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return BalanceUpdateEventDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/BookTickerResponse.ts b/binance/generated-typescript/spot_sbe/BookTickerResponse.ts index 1406441416..00d56aaaf8 100644 --- a/binance/generated-typescript/spot_sbe/BookTickerResponse.ts +++ b/binance/generated-typescript/spot_sbe/BookTickerResponse.ts @@ -11,6 +11,7 @@ export interface Tickers { bidQty: bigint; askPrice: bigint; askQty: bigint; + symbol: string; } export interface BookTickerResponse { @@ -74,16 +75,22 @@ export class BookTickerResponseDecoder { const askQty = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + items.push({ priceExponent: priceExponent, qtyExponent: qtyExponent, bidPrice: bidPrice, bidQty: bidQty, askPrice: askPrice, - askQty: askQty + askQty: askQty, + symbol: symbol }); } diff --git a/binance/generated-typescript/spot_sbe/BookTickerSymbolResponse.ts b/binance/generated-typescript/spot_sbe/BookTickerSymbolResponse.ts index 310d0b0c75..d5add67bd2 100644 --- a/binance/generated-typescript/spot_sbe/BookTickerSymbolResponse.ts +++ b/binance/generated-typescript/spot_sbe/BookTickerSymbolResponse.ts @@ -11,7 +11,7 @@ export interface BookTickerSymbolResponse { bidQty: bigint; askPrice: bigint; askQty: bigint; - symbol: Uint8Array; + symbol: string; } export class BookTickerSymbolResponseDecoder { @@ -51,8 +51,10 @@ export class BookTickerSymbolResponseDecoder { // Skip to end of block for forward compatibility pos = offset + BookTickerSymbolResponseDecoder.BLOCK_LENGTH; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; return { priceExponent: priceExponent, @@ -61,22 +63,10 @@ export class BookTickerSymbolResponseDecoder { bidQty: bidQty, askPrice: askPrice, askQty: askQty, - symbol: symbol.value + symbol: symbol }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return BookTickerSymbolResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/CancelOpenOrdersResponse.ts b/binance/generated-typescript/spot_sbe/CancelOpenOrdersResponse.ts index 6e017b62d7..46f382817e 100644 --- a/binance/generated-typescript/spot_sbe/CancelOpenOrdersResponse.ts +++ b/binance/generated-typescript/spot_sbe/CancelOpenOrdersResponse.ts @@ -5,6 +5,7 @@ */ export interface Responses { + response: Uint8Array; } export interface CancelOpenOrdersResponse { @@ -50,10 +51,16 @@ export class CancelOpenOrdersResponseDecoder { for (let i = 0; i < numInGroup; i++) { const itemStart = pos; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const responseLen = view.getUint16(pos, this.littleEndian); + pos += 2; + const response = new Uint8Array(view.buffer, view.byteOffset + pos, responseLen); + pos += responseLen; + items.push({ + response: response }); } diff --git a/binance/generated-typescript/spot_sbe/CancelOrderListResponse.ts b/binance/generated-typescript/spot_sbe/CancelOrderListResponse.ts index fd47f84a7c..4df04b8acc 100644 --- a/binance/generated-typescript/spot_sbe/CancelOrderListResponse.ts +++ b/binance/generated-typescript/spot_sbe/CancelOrderListResponse.ts @@ -6,6 +6,8 @@ export interface Orders { orderId: bigint; + symbol: string; + clientOrderId: string; } export interface OrderReports { @@ -36,6 +38,9 @@ export interface OrderReports { pegOffsetType: number; pegOffsetValue: number; peggedPrice: bigint; + symbol: string; + origClientOrderId: string; + clientOrderId: string; } export interface CancelOrderListResponse { @@ -48,8 +53,8 @@ export interface CancelOrderListResponse { qtyExponent: number; orders: Orders[]; orderReports: OrderReports[]; - listClientOrderId: Uint8Array; - symbol: Uint8Array; + listClientOrderId: string; + symbol: string; } export class CancelOrderListResponseDecoder { @@ -98,11 +103,15 @@ export class CancelOrderListResponseDecoder { const orderReports = this.decodeOrderReportsGroup(view, pos); pos = orderReports.nextOffset; - const listClientOrderId = this.decodeVarData(view, pos); - pos = listClientOrderId.nextOffset; + const listClientOrderIdLen = view.getUint8(pos); + pos += 1; + const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); + pos += listClientOrderIdLen; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; return { orderListId: orderListId, @@ -114,8 +123,8 @@ export class CancelOrderListResponseDecoder { qtyExponent: qtyExponent, orders: orders.items, orderReports: orderReports.items, - listClientOrderId: listClientOrderId.value, - symbol: symbol.value + listClientOrderId: listClientOrderId, + symbol: symbol }; } private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { @@ -134,11 +143,23 @@ export class CancelOrderListResponseDecoder { const orderId = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; + items.push({ - orderId: orderId + orderId: orderId, + symbol: symbol, + clientOrderId: clientOrderId }); } @@ -238,9 +259,24 @@ export class CancelOrderListResponseDecoder { const peggedPrice = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const origClientOrderIdLen = view.getUint8(pos); + pos += 1; + const origClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, origClientOrderIdLen)); + pos += origClientOrderIdLen; + + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; + items.push({ orderId: orderId, orderListId: orderListId, @@ -268,25 +304,16 @@ export class CancelOrderListResponseDecoder { pegPriceType: pegPriceType, pegOffsetType: pegOffsetType, pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice + peggedPrice: peggedPrice, + symbol: symbol, + origClientOrderId: origClientOrderId, + clientOrderId: clientOrderId }); } return { items, nextOffset: pos }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return CancelOrderListResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/CancelOrderResponse.ts b/binance/generated-typescript/spot_sbe/CancelOrderResponse.ts index 21b8747e42..3f05089833 100644 --- a/binance/generated-typescript/spot_sbe/CancelOrderResponse.ts +++ b/binance/generated-typescript/spot_sbe/CancelOrderResponse.ts @@ -34,9 +34,9 @@ export interface CancelOrderResponse { pegOffsetType: number; pegOffsetValue: number; peggedPrice: bigint; - symbol: Uint8Array; - origClientOrderId: Uint8Array; - clientOrderId: Uint8Array; + symbol: string; + origClientOrderId: string; + clientOrderId: string; } export class CancelOrderResponseDecoder { @@ -145,14 +145,20 @@ export class CancelOrderResponseDecoder { // Skip to end of block for forward compatibility pos = offset + CancelOrderResponseDecoder.BLOCK_LENGTH; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; - const origClientOrderId = this.decodeVarData(view, pos); - pos = origClientOrderId.nextOffset; + const origClientOrderIdLen = view.getUint8(pos); + pos += 1; + const origClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, origClientOrderIdLen)); + pos += origClientOrderIdLen; - const clientOrderId = this.decodeVarData(view, pos); - pos = clientOrderId.nextOffset; + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; return { priceExponent: priceExponent, @@ -184,24 +190,12 @@ export class CancelOrderResponseDecoder { pegOffsetType: pegOffsetType, pegOffsetValue: pegOffsetValue, peggedPrice: peggedPrice, - symbol: symbol.value, - origClientOrderId: origClientOrderId.value, - clientOrderId: clientOrderId.value + symbol: symbol, + origClientOrderId: origClientOrderId, + clientOrderId: clientOrderId }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return CancelOrderResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/CancelReplaceOrderResponse.ts b/binance/generated-typescript/spot_sbe/CancelReplaceOrderResponse.ts index 406d595c3b..e90890b8d0 100644 --- a/binance/generated-typescript/spot_sbe/CancelReplaceOrderResponse.ts +++ b/binance/generated-typescript/spot_sbe/CancelReplaceOrderResponse.ts @@ -36,32 +36,24 @@ export class CancelReplaceOrderResponseDecoder { // Skip to end of block for forward compatibility pos = offset + CancelReplaceOrderResponseDecoder.BLOCK_LENGTH; - const cancelResponse = this.decodeVarData(view, pos); - pos = cancelResponse.nextOffset; + const cancelResponseLen = view.getUint16(pos, this.littleEndian); + pos += 2; + const cancelResponse = new Uint8Array(view.buffer, view.byteOffset + pos, cancelResponseLen); + pos += cancelResponseLen; - const newOrderResponse = this.decodeVarData(view, pos); - pos = newOrderResponse.nextOffset; + const newOrderResponseLen = view.getUint32(pos, this.littleEndian); + pos += 4; + const newOrderResponse = new Uint8Array(view.buffer, view.byteOffset + pos, newOrderResponseLen); + pos += newOrderResponseLen; return { cancelResult: cancelResult, newOrderResult: newOrderResult, - cancelResponse: cancelResponse.value, - newOrderResponse: newOrderResponse.value + cancelResponse: cancelResponse, + newOrderResponse: newOrderResponse }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return CancelReplaceOrderResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/DepthResponse.ts b/binance/generated-typescript/spot_sbe/DepthResponse.ts index afe218af67..eee339a442 100644 --- a/binance/generated-typescript/spot_sbe/DepthResponse.ts +++ b/binance/generated-typescript/spot_sbe/DepthResponse.ts @@ -83,7 +83,7 @@ export class DepthResponseDecoder { const qty = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; items.push({ @@ -113,7 +113,7 @@ export class DepthResponseDecoder { const qty = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; items.push({ diff --git a/binance/generated-typescript/spot_sbe/ErrorResponse.ts b/binance/generated-typescript/spot_sbe/ErrorResponse.ts index 6690d1eed4..cbfbf59c8e 100644 --- a/binance/generated-typescript/spot_sbe/ErrorResponse.ts +++ b/binance/generated-typescript/spot_sbe/ErrorResponse.ts @@ -8,7 +8,7 @@ export interface ErrorResponse { code: number; serverTime: bigint; retryAfter: bigint; - msg: Uint8Array; + msg: string; data: Uint8Array; } @@ -40,33 +40,25 @@ export class ErrorResponseDecoder { // Skip to end of block for forward compatibility pos = offset + ErrorResponseDecoder.BLOCK_LENGTH; - const msg = this.decodeVarData(view, pos); - pos = msg.nextOffset; + const msgLen = view.getUint16(pos, this.littleEndian); + pos += 2; + const msg = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, msgLen)); + pos += msgLen; - const data = this.decodeVarData(view, pos); - pos = data.nextOffset; + const dataLen = view.getUint32(pos, this.littleEndian); + pos += 4; + const data = new Uint8Array(view.buffer, view.byteOffset + pos, dataLen); + pos += dataLen; return { code: code, serverTime: serverTime, retryAfter: retryAfter, - msg: msg.value, - data: data.value + msg: msg, + data: data }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return ErrorResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/ExchangeInfoResponse.ts b/binance/generated-typescript/spot_sbe/ExchangeInfoResponse.ts index d21b0ddc02..ddbdbd035a 100644 --- a/binance/generated-typescript/spot_sbe/ExchangeInfoResponse.ts +++ b/binance/generated-typescript/spot_sbe/ExchangeInfoResponse.ts @@ -12,6 +12,19 @@ export interface RateLimits { } export interface ExchangeFilters { + filter: Uint8Array; +} + +export interface Filters { + filter: Uint8Array; +} + +export interface Permissions { + permission: string; +} + +export interface PermissionSets { + permissions: Permissions[]; } export interface Symbols { @@ -33,9 +46,20 @@ export interface Symbols { defaultSelfTradePreventionMode: number; allowedSelfTradePreventionModes: number; pegInstructionsAllowed: number; + filters: Filters[]; + permissionSets: PermissionSets[]; + symbol: string; + baseAsset: string; + quoteAsset: string; +} + +export interface SorSymbols { + symbol: string; } export interface Sors { + sorSymbols: SorSymbols[]; + baseAsset: string; } export interface ExchangeInfoResponse { @@ -108,7 +132,7 @@ export class ExchangeInfoResponseDecoder { const rateLimit = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; items.push({ @@ -134,10 +158,16 @@ export class ExchangeInfoResponseDecoder { for (let i = 0; i < numInGroup; i++) { const itemStart = pos; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const filterLen = view.getUint8(pos); + pos += 1; + const filter = new Uint8Array(view.buffer, view.byteOffset + pos, filterLen); + pos += filterLen; + items.push({ + filter: filter }); } @@ -210,9 +240,30 @@ export class ExchangeInfoResponseDecoder { const pegInstructionsAllowed = view.getUint8(pos); pos += 1; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const filters = this.decodeFiltersGroup(view, pos); + pos = filters.nextOffset; + + const permissionSets = this.decodePermissionSetsGroup(view, pos); + pos = permissionSets.nextOffset; + + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const baseAssetLen = view.getUint8(pos); + pos += 1; + const baseAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, baseAssetLen)); + pos += baseAssetLen; + + const quoteAssetLen = view.getUint8(pos); + pos += 1; + const quoteAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, quoteAssetLen)); + pos += quoteAssetLen; + items.push({ status: status, baseAssetPrecision: baseAssetPrecision, @@ -231,7 +282,94 @@ export class ExchangeInfoResponseDecoder { isMarginTradingAllowed: isMarginTradingAllowed, defaultSelfTradePreventionMode: defaultSelfTradePreventionMode, allowedSelfTradePreventionModes: allowedSelfTradePreventionModes, - pegInstructionsAllowed: pegInstructionsAllowed + pegInstructionsAllowed: pegInstructionsAllowed, + filters: filters.items, + permissionSets: permissionSets.items, + symbol: symbol, + baseAsset: baseAsset, + quoteAsset: quoteAsset + }); + } + + return { items, nextOffset: pos }; + } + private decodeFiltersGroup(view: DataView, offset: number): { items: Filters[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Filters[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + // Skip to end of block for forward compatibility + pos = itemStart + blockLength; + + const filterLen = view.getUint8(pos); + pos += 1; + const filter = new Uint8Array(view.buffer, view.byteOffset + pos, filterLen); + pos += filterLen; + + items.push({ + filter: filter + }); + } + + return { items, nextOffset: pos }; + } + private decodePermissionSetsGroup(view: DataView, offset: number): { items: PermissionSets[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: PermissionSets[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + // Skip to end of block for forward compatibility + pos = itemStart + blockLength; + + const permissions = this.decodePermissionsGroup(view, pos); + pos = permissions.nextOffset; + + items.push({ + permissions: permissions.items + }); + } + + return { items, nextOffset: pos }; + } + private decodePermissionsGroup(view: DataView, offset: number): { items: Permissions[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Permissions[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + // Skip to end of block for forward compatibility + pos = itemStart + blockLength; + + const permissionLen = view.getUint8(pos); + pos += 1; + const permission = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, permissionLen)); + pos += permissionLen; + + items.push({ + permission: permission }); } @@ -250,10 +388,48 @@ export class ExchangeInfoResponseDecoder { for (let i = 0; i < numInGroup; i++) { const itemStart = pos; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility + pos = itemStart + blockLength; + + const sorSymbols = this.decodeSorSymbolsGroup(view, pos); + pos = sorSymbols.nextOffset; + + const baseAssetLen = view.getUint8(pos); + pos += 1; + const baseAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, baseAssetLen)); + pos += baseAssetLen; + + items.push({ + sorSymbols: sorSymbols.items, + baseAsset: baseAsset + }); + } + + return { items, nextOffset: pos }; + } + private decodeSorSymbolsGroup(view: DataView, offset: number): { items: SorSymbols[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: SorSymbols[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + items.push({ + symbol: symbol }); } diff --git a/binance/generated-typescript/spot_sbe/ExecutionReportEvent.ts b/binance/generated-typescript/spot_sbe/ExecutionReportEvent.ts index 702dbbc6cb..6dc0b31119 100644 --- a/binance/generated-typescript/spot_sbe/ExecutionReportEvent.ts +++ b/binance/generated-typescript/spot_sbe/ExecutionReportEvent.ts @@ -58,12 +58,12 @@ export interface ExecutionReportEvent { pegOffsetType: number; pegOffsetValue: number; peggedPrice: bigint; - symbol: Uint8Array; - clientOrderId: Uint8Array; - origClientOrderId: Uint8Array; - commissionAsset: Uint8Array; - rejectReason: Uint8Array; - counterSymbol: Uint8Array; + symbol: string; + clientOrderId: string; + origClientOrderId: string; + commissionAsset: string; + rejectReason: string; + counterSymbol: string; } export class ExecutionReportEventDecoder { @@ -244,23 +244,35 @@ export class ExecutionReportEventDecoder { // Skip to end of block for forward compatibility pos = offset + ExecutionReportEventDecoder.BLOCK_LENGTH; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; - const clientOrderId = this.decodeVarData(view, pos); - pos = clientOrderId.nextOffset; + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; - const origClientOrderId = this.decodeVarData(view, pos); - pos = origClientOrderId.nextOffset; + const origClientOrderIdLen = view.getUint8(pos); + pos += 1; + const origClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, origClientOrderIdLen)); + pos += origClientOrderIdLen; - const commissionAsset = this.decodeVarData(view, pos); - pos = commissionAsset.nextOffset; + const commissionAssetLen = view.getUint8(pos); + pos += 1; + const commissionAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, commissionAssetLen)); + pos += commissionAssetLen; - const rejectReason = this.decodeVarData(view, pos); - pos = rejectReason.nextOffset; + const rejectReasonLen = view.getUint8(pos); + pos += 1; + const rejectReason = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, rejectReasonLen)); + pos += rejectReasonLen; - const counterSymbol = this.decodeVarData(view, pos); - pos = counterSymbol.nextOffset; + const counterSymbolLen = view.getUint8(pos); + pos += 1; + const counterSymbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, counterSymbolLen)); + pos += counterSymbolLen; return { eventTime: eventTime, @@ -316,27 +328,15 @@ export class ExecutionReportEventDecoder { pegOffsetType: pegOffsetType, pegOffsetValue: pegOffsetValue, peggedPrice: peggedPrice, - symbol: symbol.value, - clientOrderId: clientOrderId.value, - origClientOrderId: origClientOrderId.value, - commissionAsset: commissionAsset.value, - rejectReason: rejectReason.value, - counterSymbol: counterSymbol.value + symbol: symbol, + clientOrderId: clientOrderId, + origClientOrderId: origClientOrderId, + commissionAsset: commissionAsset, + rejectReason: rejectReason, + counterSymbol: counterSymbol }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return ExecutionReportEventDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/ExternalLockUpdateEvent.ts b/binance/generated-typescript/spot_sbe/ExternalLockUpdateEvent.ts index aaa0ee8020..db0d754a86 100644 --- a/binance/generated-typescript/spot_sbe/ExternalLockUpdateEvent.ts +++ b/binance/generated-typescript/spot_sbe/ExternalLockUpdateEvent.ts @@ -10,7 +10,7 @@ export interface ExternalLockUpdateEvent { qtyExponent: number; lockedQtyDelta: bigint; subscriptionId: number; - asset: Uint8Array; + asset: string; } export class ExternalLockUpdateEventDecoder { @@ -47,8 +47,10 @@ export class ExternalLockUpdateEventDecoder { // Skip to end of block for forward compatibility pos = offset + ExternalLockUpdateEventDecoder.BLOCK_LENGTH; - const asset = this.decodeVarData(view, pos); - pos = asset.nextOffset; + const assetLen = view.getUint8(pos); + pos += 1; + const asset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, assetLen)); + pos += assetLen; return { eventTime: eventTime, @@ -56,22 +58,10 @@ export class ExternalLockUpdateEventDecoder { qtyExponent: qtyExponent, lockedQtyDelta: lockedQtyDelta, subscriptionId: subscriptionId, - asset: asset.value + asset: asset }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return ExternalLockUpdateEventDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/KlinesResponse.ts b/binance/generated-typescript/spot_sbe/KlinesResponse.ts index 9ec52b2dac..8d61e0a622 100644 --- a/binance/generated-typescript/spot_sbe/KlinesResponse.ts +++ b/binance/generated-typescript/spot_sbe/KlinesResponse.ts @@ -104,7 +104,7 @@ export class KlinesResponseDecoder { const takerBuyQuoteVolume = view.getUint8(pos); pos += 16; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; items.push({ diff --git a/binance/generated-typescript/spot_sbe/ListStatusEvent.ts b/binance/generated-typescript/spot_sbe/ListStatusEvent.ts index 61fee4e652..66b200b361 100644 --- a/binance/generated-typescript/spot_sbe/ListStatusEvent.ts +++ b/binance/generated-typescript/spot_sbe/ListStatusEvent.ts @@ -6,6 +6,8 @@ export interface Orders { orderId: bigint; + symbol: string; + clientOrderId: string; } export interface ListStatusEvent { @@ -17,9 +19,9 @@ export interface ListStatusEvent { listOrderStatus: number; subscriptionId: number; orders: Orders[]; - symbol: Uint8Array; - listClientOrderId: Uint8Array; - rejectReason: Uint8Array; + symbol: string; + listClientOrderId: string; + rejectReason: string; } export class ListStatusEventDecoder { @@ -65,14 +67,20 @@ export class ListStatusEventDecoder { const orders = this.decodeOrdersGroup(view, pos); pos = orders.nextOffset; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; - const listClientOrderId = this.decodeVarData(view, pos); - pos = listClientOrderId.nextOffset; + const listClientOrderIdLen = view.getUint8(pos); + pos += 1; + const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); + pos += listClientOrderIdLen; - const rejectReason = this.decodeVarData(view, pos); - pos = rejectReason.nextOffset; + const rejectReasonLen = view.getUint8(pos); + pos += 1; + const rejectReason = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, rejectReasonLen)); + pos += rejectReasonLen; return { eventTime: eventTime, @@ -83,9 +91,9 @@ export class ListStatusEventDecoder { listOrderStatus: listOrderStatus, subscriptionId: subscriptionId, orders: orders.items, - symbol: symbol.value, - listClientOrderId: listClientOrderId.value, - rejectReason: rejectReason.value + symbol: symbol, + listClientOrderId: listClientOrderId, + rejectReason: rejectReason }; } private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { @@ -104,29 +112,29 @@ export class ListStatusEventDecoder { const orderId = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; + items.push({ - orderId: orderId + orderId: orderId, + symbol: symbol, + clientOrderId: clientOrderId }); } return { items, nextOffset: pos }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return ListStatusEventDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/MaxAssetFilter.ts b/binance/generated-typescript/spot_sbe/MaxAssetFilter.ts index d863d5c39e..edf84d6e31 100644 --- a/binance/generated-typescript/spot_sbe/MaxAssetFilter.ts +++ b/binance/generated-typescript/spot_sbe/MaxAssetFilter.ts @@ -8,7 +8,7 @@ export interface MaxAssetFilter { filterType: number; qtyExponent: number; maxQty: bigint; - asset: Uint8Array; + asset: string; } export class MaxAssetFilterDecoder { @@ -39,29 +39,19 @@ export class MaxAssetFilterDecoder { // Skip to end of block for forward compatibility pos = offset + MaxAssetFilterDecoder.BLOCK_LENGTH; - const asset = this.decodeVarData(view, pos); - pos = asset.nextOffset; + const assetLen = view.getUint8(pos); + pos += 1; + const asset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, assetLen)); + pos += assetLen; return { filterType: filterType, qtyExponent: qtyExponent, maxQty: maxQty, - asset: asset.value + asset: asset }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return MaxAssetFilterDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/MyFiltersResponse.ts b/binance/generated-typescript/spot_sbe/MyFiltersResponse.ts index 86e0f02621..41e1617387 100644 --- a/binance/generated-typescript/spot_sbe/MyFiltersResponse.ts +++ b/binance/generated-typescript/spot_sbe/MyFiltersResponse.ts @@ -5,12 +5,15 @@ */ export interface ExchangeFilters { + filter: Uint8Array; } export interface SymbolFilters { + filter: Uint8Array; } export interface AssetFilters { + filter: Uint8Array; } export interface MyFiltersResponse { @@ -66,10 +69,16 @@ export class MyFiltersResponseDecoder { for (let i = 0; i < numInGroup; i++) { const itemStart = pos; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const filterLen = view.getUint8(pos); + pos += 1; + const filter = new Uint8Array(view.buffer, view.byteOffset + pos, filterLen); + pos += filterLen; + items.push({ + filter: filter }); } @@ -88,10 +97,16 @@ export class MyFiltersResponseDecoder { for (let i = 0; i < numInGroup; i++) { const itemStart = pos; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const filterLen = view.getUint8(pos); + pos += 1; + const filter = new Uint8Array(view.buffer, view.byteOffset + pos, filterLen); + pos += filterLen; + items.push({ + filter: filter }); } @@ -110,10 +125,16 @@ export class MyFiltersResponseDecoder { for (let i = 0; i < numInGroup; i++) { const itemStart = pos; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const filterLen = view.getUint8(pos); + pos += 1; + const filter = new Uint8Array(view.buffer, view.byteOffset + pos, filterLen); + pos += filterLen; + items.push({ + filter: filter }); } diff --git a/binance/generated-typescript/spot_sbe/NewOrderAckResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderAckResponse.ts index 664f55271f..910445d9f4 100644 --- a/binance/generated-typescript/spot_sbe/NewOrderAckResponse.ts +++ b/binance/generated-typescript/spot_sbe/NewOrderAckResponse.ts @@ -8,8 +8,8 @@ export interface NewOrderAckResponse { orderId: bigint; orderListId: bigint; transactTime: bigint; - symbol: Uint8Array; - clientOrderId: Uint8Array; + symbol: string; + clientOrderId: string; } export class NewOrderAckResponseDecoder { @@ -40,33 +40,25 @@ export class NewOrderAckResponseDecoder { // Skip to end of block for forward compatibility pos = offset + NewOrderAckResponseDecoder.BLOCK_LENGTH; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; - const clientOrderId = this.decodeVarData(view, pos); - pos = clientOrderId.nextOffset; + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; return { orderId: orderId, orderListId: orderListId, transactTime: transactTime, - symbol: symbol.value, - clientOrderId: clientOrderId.value + symbol: symbol, + clientOrderId: clientOrderId }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return NewOrderAckResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/NewOrderFullResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderFullResponse.ts index 1aa1c61df4..5b9ead1ec5 100644 --- a/binance/generated-typescript/spot_sbe/NewOrderFullResponse.ts +++ b/binance/generated-typescript/spot_sbe/NewOrderFullResponse.ts @@ -12,6 +12,7 @@ export interface Fills { commission: bigint; tradeId: bigint; allocId: bigint; + commissionAsset: string; } export interface PreventedMatches { @@ -20,6 +21,7 @@ export interface PreventedMatches { price: bigint; takerPreventedQuantity: bigint; makerPreventedQuantity: bigint; + makerSymbol: string; } export interface NewOrderFullResponse { @@ -56,8 +58,8 @@ export interface NewOrderFullResponse { peggedPrice: bigint; fills: Fills[]; preventedMatches: PreventedMatches[]; - symbol: Uint8Array; - clientOrderId: Uint8Array; + symbol: string; + clientOrderId: string; } export class NewOrderFullResponseDecoder { @@ -178,11 +180,15 @@ export class NewOrderFullResponseDecoder { const preventedMatches = this.decodePreventedMatchesGroup(view, pos); pos = preventedMatches.nextOffset; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; - const clientOrderId = this.decodeVarData(view, pos); - pos = clientOrderId.nextOffset; + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; return { priceExponent: priceExponent, @@ -218,8 +224,8 @@ export class NewOrderFullResponseDecoder { peggedPrice: peggedPrice, fills: fills.items, preventedMatches: preventedMatches.items, - symbol: symbol.value, - clientOrderId: clientOrderId.value + symbol: symbol, + clientOrderId: clientOrderId }; } private decodeFillsGroup(view: DataView, offset: number): { items: Fills[], nextOffset: number } { @@ -256,9 +262,14 @@ export class NewOrderFullResponseDecoder { const allocId = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const commissionAssetLen = view.getUint8(pos); + pos += 1; + const commissionAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, commissionAssetLen)); + pos += commissionAssetLen; + items.push({ commissionExponent: commissionExponent, matchType: matchType, @@ -266,7 +277,8 @@ export class NewOrderFullResponseDecoder { qty: qty, commission: commission, tradeId: tradeId, - allocId: allocId + allocId: allocId, + commissionAsset: commissionAsset }); } @@ -300,33 +312,27 @@ export class NewOrderFullResponseDecoder { const makerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const makerSymbolLen = view.getUint8(pos); + pos += 1; + const makerSymbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, makerSymbolLen)); + pos += makerSymbolLen; + items.push({ preventedMatchId: preventedMatchId, makerOrderId: makerOrderId, price: price, takerPreventedQuantity: takerPreventedQuantity, - makerPreventedQuantity: makerPreventedQuantity + makerPreventedQuantity: makerPreventedQuantity, + makerSymbol: makerSymbol }); } return { items, nextOffset: pos }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return NewOrderFullResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/NewOrderListAckResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderListAckResponse.ts index 66d1454b3f..0efd9417e2 100644 --- a/binance/generated-typescript/spot_sbe/NewOrderListAckResponse.ts +++ b/binance/generated-typescript/spot_sbe/NewOrderListAckResponse.ts @@ -6,12 +6,16 @@ export interface Orders { orderId: bigint; + symbol: string; + clientOrderId: string; } export interface OrderReports { orderId: bigint; orderListId: bigint; transactTime: bigint; + symbol: string; + clientOrderId: string; } export interface NewOrderListAckResponse { @@ -22,8 +26,8 @@ export interface NewOrderListAckResponse { transactionTime: bigint; orders: Orders[]; orderReports: OrderReports[]; - listClientOrderId: Uint8Array; - symbol: Uint8Array; + listClientOrderId: string; + symbol: string; } export class NewOrderListAckResponseDecoder { @@ -66,11 +70,15 @@ export class NewOrderListAckResponseDecoder { const orderReports = this.decodeOrderReportsGroup(view, pos); pos = orderReports.nextOffset; - const listClientOrderId = this.decodeVarData(view, pos); - pos = listClientOrderId.nextOffset; + const listClientOrderIdLen = view.getUint8(pos); + pos += 1; + const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); + pos += listClientOrderIdLen; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; return { orderListId: orderListId, @@ -80,8 +88,8 @@ export class NewOrderListAckResponseDecoder { transactionTime: transactionTime, orders: orders.items, orderReports: orderReports.items, - listClientOrderId: listClientOrderId.value, - symbol: symbol.value + listClientOrderId: listClientOrderId, + symbol: symbol }; } private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { @@ -100,11 +108,23 @@ export class NewOrderListAckResponseDecoder { const orderId = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; + items.push({ - orderId: orderId + orderId: orderId, + symbol: symbol, + clientOrderId: clientOrderId }); } @@ -132,31 +152,31 @@ export class NewOrderListAckResponseDecoder { const transactTime = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; + items.push({ orderId: orderId, orderListId: orderListId, - transactTime: transactTime + transactTime: transactTime, + symbol: symbol, + clientOrderId: clientOrderId }); } return { items, nextOffset: pos }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return NewOrderListAckResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/NewOrderListFullResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderListFullResponse.ts index 6fc493e340..058f4a0f1f 100644 --- a/binance/generated-typescript/spot_sbe/NewOrderListFullResponse.ts +++ b/binance/generated-typescript/spot_sbe/NewOrderListFullResponse.ts @@ -6,6 +6,28 @@ export interface Orders { orderId: bigint; + symbol: string; + clientOrderId: string; +} + +export interface Fills { + commissionExponent: number; + matchType: number; + price: bigint; + qty: bigint; + commission: bigint; + tradeId: bigint; + allocId: bigint; + commissionAsset: string; +} + +export interface PreventedMatches { + preventedMatchId: bigint; + makerOrderId: bigint; + price: bigint; + takerPreventedQuantity: bigint; + makerPreventedQuantity: bigint; + makerSymbol: string; } export interface OrderReports { @@ -38,16 +60,10 @@ export interface OrderReports { pegOffsetType: number; pegOffsetValue: number; peggedPrice: bigint; - commissionExponent: number; - matchType: number; - qty: bigint; - commission: bigint; - tradeId: bigint; - allocId: bigint; - preventedMatchId: bigint; - makerOrderId: bigint; - takerPreventedQuantity: bigint; - makerPreventedQuantity: bigint; + fills: Fills[]; + preventedMatches: PreventedMatches[]; + symbol: string; + clientOrderId: string; } export interface NewOrderListFullResponse { @@ -60,8 +76,8 @@ export interface NewOrderListFullResponse { qtyExponent: number; orders: Orders[]; orderReports: OrderReports[]; - listClientOrderId: Uint8Array; - symbol: Uint8Array; + listClientOrderId: string; + symbol: string; } export class NewOrderListFullResponseDecoder { @@ -110,11 +126,15 @@ export class NewOrderListFullResponseDecoder { const orderReports = this.decodeOrderReportsGroup(view, pos); pos = orderReports.nextOffset; - const listClientOrderId = this.decodeVarData(view, pos); - pos = listClientOrderId.nextOffset; + const listClientOrderIdLen = view.getUint8(pos); + pos += 1; + const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); + pos += listClientOrderIdLen; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; return { orderListId: orderListId, @@ -126,8 +146,8 @@ export class NewOrderListFullResponseDecoder { qtyExponent: qtyExponent, orders: orders.items, orderReports: orderReports.items, - listClientOrderId: listClientOrderId.value, - symbol: symbol.value + listClientOrderId: listClientOrderId, + symbol: symbol }; } private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { @@ -146,11 +166,23 @@ export class NewOrderListFullResponseDecoder { const orderId = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; + items.push({ - orderId: orderId + orderId: orderId, + symbol: symbol, + clientOrderId: clientOrderId }); } @@ -256,42 +288,24 @@ export class NewOrderListFullResponseDecoder { const peggedPrice = view.getBigInt64(pos, this.littleEndian); pos += 8; - const commissionExponent = view.getInt8(pos); - pos += 1; - - const matchType = view.getUint8(pos); - pos += 1; - - pos += 8; - - const qty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const commission = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const tradeId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const allocId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedMatchId = view.getBigInt64(pos, this.littleEndian); - pos += 8; + // Skip to end of block for forward compatibility + pos = itemStart + blockLength; - const makerOrderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; + const fills = this.decodeFillsGroup(view, pos); + pos = fills.nextOffset; - pos += 8; + const preventedMatches = this.decodePreventedMatchesGroup(view, pos); + pos = preventedMatches.nextOffset; - const takerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const makerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; - // Skip to next block for forward compatibility - pos = itemStart + blockLength; + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; items.push({ orderId: orderId, @@ -323,32 +337,118 @@ export class NewOrderListFullResponseDecoder { pegOffsetType: pegOffsetType, pegOffsetValue: pegOffsetValue, peggedPrice: peggedPrice, + fills: fills.items, + preventedMatches: preventedMatches.items, + symbol: symbol, + clientOrderId: clientOrderId + }); + } + + return { items, nextOffset: pos }; + } + private decodeFillsGroup(view: DataView, offset: number): { items: Fills[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Fills[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const commissionExponent = view.getInt8(pos); + pos += 1; + + const matchType = view.getUint8(pos); + pos += 1; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const qty = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const commission = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const tradeId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const allocId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = itemStart + blockLength; + + const commissionAssetLen = view.getUint8(pos); + pos += 1; + const commissionAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, commissionAssetLen)); + pos += commissionAssetLen; + + items.push({ commissionExponent: commissionExponent, matchType: matchType, + price: price, qty: qty, commission: commission, tradeId: tradeId, allocId: allocId, - preventedMatchId: preventedMatchId, - makerOrderId: makerOrderId, - takerPreventedQuantity: takerPreventedQuantity, - makerPreventedQuantity: makerPreventedQuantity + commissionAsset: commissionAsset }); } return { items, nextOffset: pos }; } - - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { + private decodePreventedMatchesGroup(view: DataView, offset: number): { items: PreventedMatches[], nextOffset: number } { let pos = offset; - const length = view.getUint32(pos, this.littleEndian); + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); pos += 4; - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; + const items: PreventedMatches[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const preventedMatchId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const makerOrderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const price = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const takerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + const makerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = itemStart + blockLength; + + const makerSymbolLen = view.getUint8(pos); + pos += 1; + const makerSymbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, makerSymbolLen)); + pos += makerSymbolLen; - return { value, nextOffset: pos }; + items.push({ + preventedMatchId: preventedMatchId, + makerOrderId: makerOrderId, + price: price, + takerPreventedQuantity: takerPreventedQuantity, + makerPreventedQuantity: makerPreventedQuantity, + makerSymbol: makerSymbol + }); + } + + return { items, nextOffset: pos }; } static getBlockLength(): number { diff --git a/binance/generated-typescript/spot_sbe/NewOrderListResultResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderListResultResponse.ts index c8a790c781..fbb280d8b8 100644 --- a/binance/generated-typescript/spot_sbe/NewOrderListResultResponse.ts +++ b/binance/generated-typescript/spot_sbe/NewOrderListResultResponse.ts @@ -6,6 +6,8 @@ export interface Orders { orderId: bigint; + symbol: string; + clientOrderId: string; } export interface OrderReports { @@ -38,6 +40,8 @@ export interface OrderReports { pegOffsetType: number; pegOffsetValue: number; peggedPrice: bigint; + symbol: string; + clientOrderId: string; } export interface NewOrderListResultResponse { @@ -50,8 +54,8 @@ export interface NewOrderListResultResponse { qtyExponent: number; orders: Orders[]; orderReports: OrderReports[]; - listClientOrderId: Uint8Array; - symbol: Uint8Array; + listClientOrderId: string; + symbol: string; } export class NewOrderListResultResponseDecoder { @@ -100,11 +104,15 @@ export class NewOrderListResultResponseDecoder { const orderReports = this.decodeOrderReportsGroup(view, pos); pos = orderReports.nextOffset; - const listClientOrderId = this.decodeVarData(view, pos); - pos = listClientOrderId.nextOffset; + const listClientOrderIdLen = view.getUint8(pos); + pos += 1; + const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); + pos += listClientOrderIdLen; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; return { orderListId: orderListId, @@ -116,8 +124,8 @@ export class NewOrderListResultResponseDecoder { qtyExponent: qtyExponent, orders: orders.items, orderReports: orderReports.items, - listClientOrderId: listClientOrderId.value, - symbol: symbol.value + listClientOrderId: listClientOrderId, + symbol: symbol }; } private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { @@ -136,11 +144,23 @@ export class NewOrderListResultResponseDecoder { const orderId = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; + items.push({ - orderId: orderId + orderId: orderId, + symbol: symbol, + clientOrderId: clientOrderId }); } @@ -246,9 +266,19 @@ export class NewOrderListResultResponseDecoder { const peggedPrice = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; + items.push({ orderId: orderId, orderListId: orderListId, @@ -278,25 +308,15 @@ export class NewOrderListResultResponseDecoder { pegPriceType: pegPriceType, pegOffsetType: pegOffsetType, pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice + peggedPrice: peggedPrice, + symbol: symbol, + clientOrderId: clientOrderId }); } return { items, nextOffset: pos }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return NewOrderListResultResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/NewOrderResultResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderResultResponse.ts index ab6a286088..60311ea4a2 100644 --- a/binance/generated-typescript/spot_sbe/NewOrderResultResponse.ts +++ b/binance/generated-typescript/spot_sbe/NewOrderResultResponse.ts @@ -36,8 +36,8 @@ export interface NewOrderResultResponse { pegOffsetType: number; pegOffsetValue: number; peggedPrice: bigint; - symbol: Uint8Array; - clientOrderId: Uint8Array; + symbol: string; + clientOrderId: string; } export class NewOrderResultResponseDecoder { @@ -152,11 +152,15 @@ export class NewOrderResultResponseDecoder { // Skip to end of block for forward compatibility pos = offset + NewOrderResultResponseDecoder.BLOCK_LENGTH; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; - const clientOrderId = this.decodeVarData(view, pos); - pos = clientOrderId.nextOffset; + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; return { priceExponent: priceExponent, @@ -190,23 +194,11 @@ export class NewOrderResultResponseDecoder { pegOffsetType: pegOffsetType, pegOffsetValue: pegOffsetValue, peggedPrice: peggedPrice, - symbol: symbol.value, - clientOrderId: clientOrderId.value + symbol: symbol, + clientOrderId: clientOrderId }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return NewOrderResultResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/OrderAmendKeepPriorityResponse.ts b/binance/generated-typescript/spot_sbe/OrderAmendKeepPriorityResponse.ts index 6dd4750a4e..08c6498517 100644 --- a/binance/generated-typescript/spot_sbe/OrderAmendKeepPriorityResponse.ts +++ b/binance/generated-typescript/spot_sbe/OrderAmendKeepPriorityResponse.ts @@ -4,11 +4,19 @@ * DO NOT EDIT */ +export interface Orders { + orderId: bigint; + symbol: string; + clientOrderId: string; +} + export interface ListStatus { orderListId: bigint; contingencyType: number; listOrderStatus: number; - orderId: bigint; + orders: Orders[]; + listClientOrderId: string; + symbol: string; } export interface RelatedOrders { @@ -38,6 +46,8 @@ export interface RelatedOrders { pegOffsetType: number; pegOffsetValue: number; peggedPrice: bigint; + symbol: string; + clientOrderId: string; } export interface OrderAmendKeepPriorityResponse { @@ -73,9 +83,9 @@ export interface OrderAmendKeepPriorityResponse { peggedPrice: bigint; listStatus: ListStatus[]; relatedOrders: RelatedOrders[]; - symbol: Uint8Array; - origClientOrderId: Uint8Array; - clientOrderId: Uint8Array; + symbol: string; + origClientOrderId: string; + clientOrderId: string; } export class OrderAmendKeepPriorityResponseDecoder { @@ -193,14 +203,20 @@ export class OrderAmendKeepPriorityResponseDecoder { const relatedOrders = this.decodeRelatedOrdersGroup(view, pos); pos = relatedOrders.nextOffset; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; - const origClientOrderId = this.decodeVarData(view, pos); - pos = origClientOrderId.nextOffset; + const origClientOrderIdLen = view.getUint8(pos); + pos += 1; + const origClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, origClientOrderIdLen)); + pos += origClientOrderIdLen; - const clientOrderId = this.decodeVarData(view, pos); - pos = clientOrderId.nextOffset; + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; return { transactTime: transactTime, @@ -235,9 +251,9 @@ export class OrderAmendKeepPriorityResponseDecoder { peggedPrice: peggedPrice, listStatus: listStatus.items, relatedOrders: relatedOrders.items, - symbol: symbol.value, - origClientOrderId: origClientOrderId.value, - clientOrderId: clientOrderId.value + symbol: symbol, + origClientOrderId: origClientOrderId, + clientOrderId: clientOrderId }; } private decodeListStatusGroup(view: DataView, offset: number): { items: ListStatus[], nextOffset: number } { @@ -262,17 +278,67 @@ export class OrderAmendKeepPriorityResponseDecoder { const listOrderStatus = view.getUint8(pos); pos += 1; - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const orders = this.decodeOrdersGroup(view, pos); + pos = orders.nextOffset; + + const listClientOrderIdLen = view.getUint8(pos); + pos += 1; + const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); + pos += listClientOrderIdLen; + + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + items.push({ orderListId: orderListId, contingencyType: contingencyType, listOrderStatus: listOrderStatus, - orderId: orderId + orders: orders.items, + listClientOrderId: listClientOrderId, + symbol: symbol + }); + } + + return { items, nextOffset: pos }; + } + private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint16(pos, this.littleEndian); + pos += 2; + + const items: Orders[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = itemStart + blockLength; + + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; + + items.push({ + orderId: orderId, + symbol: symbol, + clientOrderId: clientOrderId }); } @@ -369,9 +435,19 @@ export class OrderAmendKeepPriorityResponseDecoder { const peggedPrice = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; + items.push({ orderId: orderId, orderListId: orderListId, @@ -398,25 +474,15 @@ export class OrderAmendKeepPriorityResponseDecoder { pegPriceType: pegPriceType, pegOffsetType: pegOffsetType, pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice + peggedPrice: peggedPrice, + symbol: symbol, + clientOrderId: clientOrderId }); } return { items, nextOffset: pos }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return OrderAmendKeepPriorityResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/OrderAmendmentsResponse.ts b/binance/generated-typescript/spot_sbe/OrderAmendmentsResponse.ts index f1542887b2..dcb35e5471 100644 --- a/binance/generated-typescript/spot_sbe/OrderAmendmentsResponse.ts +++ b/binance/generated-typescript/spot_sbe/OrderAmendmentsResponse.ts @@ -11,6 +11,9 @@ export interface Amendments { origQty: bigint; newQty: bigint; time: bigint; + symbol: string; + origClientOrderId: string; + newClientOrderId: string; } export interface OrderAmendmentsResponse { @@ -74,16 +77,34 @@ export class OrderAmendmentsResponseDecoder { const time = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const origClientOrderIdLen = view.getUint8(pos); + pos += 1; + const origClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, origClientOrderIdLen)); + pos += origClientOrderIdLen; + + const newClientOrderIdLen = view.getUint8(pos); + pos += 1; + const newClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, newClientOrderIdLen)); + pos += newClientOrderIdLen; + items.push({ orderId: orderId, executionId: executionId, qtyExponent: qtyExponent, origQty: origQty, newQty: newQty, - time: time + time: time, + symbol: symbol, + origClientOrderId: origClientOrderId, + newClientOrderId: newClientOrderId }); } diff --git a/binance/generated-typescript/spot_sbe/OrderListResponse.ts b/binance/generated-typescript/spot_sbe/OrderListResponse.ts index 09f12fe76d..0ff3910dd7 100644 --- a/binance/generated-typescript/spot_sbe/OrderListResponse.ts +++ b/binance/generated-typescript/spot_sbe/OrderListResponse.ts @@ -6,6 +6,8 @@ export interface Orders { orderId: bigint; + symbol: string; + clientOrderId: string; } export interface OrderListResponse { @@ -15,8 +17,8 @@ export interface OrderListResponse { listOrderStatus: number; transactionTime: bigint; orders: Orders[]; - listClientOrderId: Uint8Array; - symbol: Uint8Array; + listClientOrderId: string; + symbol: string; } export class OrderListResponseDecoder { @@ -56,11 +58,15 @@ export class OrderListResponseDecoder { const orders = this.decodeOrdersGroup(view, pos); pos = orders.nextOffset; - const listClientOrderId = this.decodeVarData(view, pos); - pos = listClientOrderId.nextOffset; + const listClientOrderIdLen = view.getUint8(pos); + pos += 1; + const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); + pos += listClientOrderIdLen; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; return { orderListId: orderListId, @@ -69,8 +75,8 @@ export class OrderListResponseDecoder { listOrderStatus: listOrderStatus, transactionTime: transactionTime, orders: orders.items, - listClientOrderId: listClientOrderId.value, - symbol: symbol.value + listClientOrderId: listClientOrderId, + symbol: symbol }; } private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { @@ -89,29 +95,29 @@ export class OrderListResponseDecoder { const orderId = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; + items.push({ - orderId: orderId + orderId: orderId, + symbol: symbol, + clientOrderId: clientOrderId }); } return { items, nextOffset: pos }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return OrderListResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/OrderListsResponse.ts b/binance/generated-typescript/spot_sbe/OrderListsResponse.ts index e8ded8cce9..cbcd7b4df3 100644 --- a/binance/generated-typescript/spot_sbe/OrderListsResponse.ts +++ b/binance/generated-typescript/spot_sbe/OrderListsResponse.ts @@ -4,13 +4,21 @@ * DO NOT EDIT */ +export interface Orders { + orderId: bigint; + symbol: string; + clientOrderId: string; +} + export interface OrderLists { orderListId: bigint; contingencyType: number; listStatusType: number; listOrderStatus: number; transactionTime: bigint; - orderId: bigint; + orders: Orders[]; + listClientOrderId: string; + symbol: string; } export interface OrderListsResponse { @@ -71,19 +79,69 @@ export class OrderListsResponseDecoder { const transactionTime = view.getBigInt64(pos, this.littleEndian); pos += 8; - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const orders = this.decodeOrdersGroup(view, pos); + pos = orders.nextOffset; + + const listClientOrderIdLen = view.getUint8(pos); + pos += 1; + const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); + pos += listClientOrderIdLen; + + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + items.push({ orderListId: orderListId, contingencyType: contingencyType, listStatusType: listStatusType, listOrderStatus: listOrderStatus, transactionTime: transactionTime, - orderId: orderId + orders: orders.items, + listClientOrderId: listClientOrderId, + symbol: symbol + }); + } + + return { items, nextOffset: pos }; + } + private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { + let pos = offset; + + const blockLength = view.getUint16(pos, this.littleEndian); + pos += 2; + const numInGroup = view.getUint32(pos, this.littleEndian); + pos += 4; + + const items: Orders[] = []; + + for (let i = 0; i < numInGroup; i++) { + const itemStart = pos; + + const orderId = view.getBigInt64(pos, this.littleEndian); + pos += 8; + + // Skip to end of block for forward compatibility + pos = itemStart + blockLength; + + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; + + items.push({ + orderId: orderId, + symbol: symbol, + clientOrderId: clientOrderId }); } diff --git a/binance/generated-typescript/spot_sbe/OrderResponse.ts b/binance/generated-typescript/spot_sbe/OrderResponse.ts index 79f3faf965..a12ae3e894 100644 --- a/binance/generated-typescript/spot_sbe/OrderResponse.ts +++ b/binance/generated-typescript/spot_sbe/OrderResponse.ts @@ -38,8 +38,8 @@ export interface OrderResponse { pegOffsetType: number; pegOffsetValue: number; peggedPrice: bigint; - symbol: Uint8Array; - clientOrderId: Uint8Array; + symbol: string; + clientOrderId: string; } export class OrderResponseDecoder { @@ -160,11 +160,15 @@ export class OrderResponseDecoder { // Skip to end of block for forward compatibility pos = offset + OrderResponseDecoder.BLOCK_LENGTH; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; - const clientOrderId = this.decodeVarData(view, pos); - pos = clientOrderId.nextOffset; + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; return { priceExponent: priceExponent, @@ -200,23 +204,11 @@ export class OrderResponseDecoder { pegOffsetType: pegOffsetType, pegOffsetValue: pegOffsetValue, peggedPrice: peggedPrice, - symbol: symbol.value, - clientOrderId: clientOrderId.value + symbol: symbol, + clientOrderId: clientOrderId }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return OrderResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/OrderTestWithCommissionsResponse.ts b/binance/generated-typescript/spot_sbe/OrderTestWithCommissionsResponse.ts index 364f56cc03..64a9b1a9a6 100644 --- a/binance/generated-typescript/spot_sbe/OrderTestWithCommissionsResponse.ts +++ b/binance/generated-typescript/spot_sbe/OrderTestWithCommissionsResponse.ts @@ -16,7 +16,7 @@ export interface OrderTestWithCommissionsResponse { discount: bigint; specialCommissionForOrderMaker: bigint; specialCommissionForOrderTaker: bigint; - discountAsset: Uint8Array; + discountAsset: string; } export class OrderTestWithCommissionsResponseDecoder { @@ -71,8 +71,10 @@ export class OrderTestWithCommissionsResponseDecoder { // Skip to end of block for forward compatibility pos = offset + OrderTestWithCommissionsResponseDecoder.BLOCK_LENGTH; - const discountAsset = this.decodeVarData(view, pos); - pos = discountAsset.nextOffset; + const discountAssetLen = view.getUint8(pos); + pos += 1; + const discountAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, discountAssetLen)); + pos += discountAssetLen; return { commissionExponent: commissionExponent, @@ -86,22 +88,10 @@ export class OrderTestWithCommissionsResponseDecoder { discount: discount, specialCommissionForOrderMaker: specialCommissionForOrderMaker, specialCommissionForOrderTaker: specialCommissionForOrderTaker, - discountAsset: discountAsset.value + discountAsset: discountAsset }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return OrderTestWithCommissionsResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/OrdersResponse.ts b/binance/generated-typescript/spot_sbe/OrdersResponse.ts index 388a334214..87f404ddbf 100644 --- a/binance/generated-typescript/spot_sbe/OrdersResponse.ts +++ b/binance/generated-typescript/spot_sbe/OrdersResponse.ts @@ -38,6 +38,8 @@ export interface Orders { pegOffsetType: number; pegOffsetValue: number; peggedPrice: bigint; + symbol: string; + clientOrderId: string; } export interface OrdersResponse { @@ -182,9 +184,19 @@ export class OrdersResponseDecoder { const peggedPrice = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + + const clientOrderIdLen = view.getUint8(pos); + pos += 1; + const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); + pos += clientOrderIdLen; + items.push({ priceExponent: priceExponent, qtyExponent: qtyExponent, @@ -218,7 +230,9 @@ export class OrdersResponseDecoder { pegPriceType: pegPriceType, pegOffsetType: pegOffsetType, pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice + peggedPrice: peggedPrice, + symbol: symbol, + clientOrderId: clientOrderId }); } diff --git a/binance/generated-typescript/spot_sbe/OutboundAccountPositionEvent.ts b/binance/generated-typescript/spot_sbe/OutboundAccountPositionEvent.ts index 4b23c9879a..702645d48b 100644 --- a/binance/generated-typescript/spot_sbe/OutboundAccountPositionEvent.ts +++ b/binance/generated-typescript/spot_sbe/OutboundAccountPositionEvent.ts @@ -8,6 +8,7 @@ export interface Balances { exponent: number; free: bigint; locked: bigint; + asset: string; } export interface OutboundAccountPositionEvent { @@ -77,13 +78,19 @@ export class OutboundAccountPositionEventDecoder { const locked = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const assetLen = view.getUint8(pos); + pos += 1; + const asset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, assetLen)); + pos += assetLen; + items.push({ exponent: exponent, free: free, - locked: locked + locked: locked, + asset: asset }); } diff --git a/binance/generated-typescript/spot_sbe/PriceTickerResponse.ts b/binance/generated-typescript/spot_sbe/PriceTickerResponse.ts index 47499d6922..a1ac0d55da 100644 --- a/binance/generated-typescript/spot_sbe/PriceTickerResponse.ts +++ b/binance/generated-typescript/spot_sbe/PriceTickerResponse.ts @@ -7,6 +7,7 @@ export interface Tickers { priceExponent: number; price: bigint; + symbol: string; } export interface PriceTickerResponse { @@ -58,12 +59,18 @@ export class PriceTickerResponseDecoder { const price = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + items.push({ priceExponent: priceExponent, - price: price + price: price, + symbol: symbol }); } diff --git a/binance/generated-typescript/spot_sbe/PriceTickerSymbolResponse.ts b/binance/generated-typescript/spot_sbe/PriceTickerSymbolResponse.ts index bfae607ce1..d5bee8a41c 100644 --- a/binance/generated-typescript/spot_sbe/PriceTickerSymbolResponse.ts +++ b/binance/generated-typescript/spot_sbe/PriceTickerSymbolResponse.ts @@ -7,7 +7,7 @@ export interface PriceTickerSymbolResponse { priceExponent: number; price: bigint; - symbol: Uint8Array; + symbol: string; } export class PriceTickerSymbolResponseDecoder { @@ -35,28 +35,18 @@ export class PriceTickerSymbolResponseDecoder { // Skip to end of block for forward compatibility pos = offset + PriceTickerSymbolResponseDecoder.BLOCK_LENGTH; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; return { priceExponent: priceExponent, price: price, - symbol: symbol.value + symbol: symbol }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return PriceTickerSymbolResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/TPlusFilterLockEvent.ts b/binance/generated-typescript/spot_sbe/TPlusFilterLockEvent.ts index 73832de071..5d22413a08 100644 --- a/binance/generated-typescript/spot_sbe/TPlusFilterLockEvent.ts +++ b/binance/generated-typescript/spot_sbe/TPlusFilterLockEvent.ts @@ -14,8 +14,8 @@ export interface TPlusFilterLockEvent { qtyExponent: number; subscriptionId: number; unlockData: UnlockData[]; - symbol: Uint8Array; - baseAsset: Uint8Array; + symbol: string; + baseAsset: string; } export class TPlusFilterLockEventDecoder { @@ -49,19 +49,23 @@ export class TPlusFilterLockEventDecoder { const unlockData = this.decodeUnlockDataGroup(view, pos); pos = unlockData.nextOffset; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; - const baseAsset = this.decodeVarData(view, pos); - pos = baseAsset.nextOffset; + const baseAssetLen = view.getUint8(pos); + pos += 1; + const baseAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, baseAssetLen)); + pos += baseAssetLen; return { eventTime: eventTime, qtyExponent: qtyExponent, subscriptionId: subscriptionId, unlockData: unlockData.items, - symbol: symbol.value, - baseAsset: baseAsset.value + symbol: symbol, + baseAsset: baseAsset }; } private decodeUnlockDataGroup(view: DataView, offset: number): { items: UnlockData[], nextOffset: number } { @@ -83,7 +87,7 @@ export class TPlusFilterLockEventDecoder { const qty = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; items.push({ @@ -95,18 +99,6 @@ export class TPlusFilterLockEventDecoder { return { items, nextOffset: pos }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return TPlusFilterLockEventDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/Ticker24hFullResponse.ts b/binance/generated-typescript/spot_sbe/Ticker24hFullResponse.ts index 113acdfb9d..643c66e6c7 100644 --- a/binance/generated-typescript/spot_sbe/Ticker24hFullResponse.ts +++ b/binance/generated-typescript/spot_sbe/Ticker24hFullResponse.ts @@ -27,6 +27,7 @@ export interface Tickers { firstId: bigint; lastId: bigint; numTrades: bigint; + symbol: string; } export interface Ticker24hFullResponse { @@ -138,9 +139,14 @@ export class Ticker24hFullResponseDecoder { const numTrades = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + items.push({ priceExponent: priceExponent, qtyExponent: qtyExponent, @@ -163,7 +169,8 @@ export class Ticker24hFullResponseDecoder { closeTime: closeTime, firstId: firstId, lastId: lastId, - numTrades: numTrades + numTrades: numTrades, + symbol: symbol }); } diff --git a/binance/generated-typescript/spot_sbe/Ticker24hMiniResponse.ts b/binance/generated-typescript/spot_sbe/Ticker24hMiniResponse.ts index 9cd17bf86c..afe296ebda 100644 --- a/binance/generated-typescript/spot_sbe/Ticker24hMiniResponse.ts +++ b/binance/generated-typescript/spot_sbe/Ticker24hMiniResponse.ts @@ -18,6 +18,7 @@ export interface Tickers { firstId: bigint; lastId: bigint; numTrades: bigint; + symbol: string; } export interface Ticker24hMiniResponse { @@ -102,9 +103,14 @@ export class Ticker24hMiniResponseDecoder { const numTrades = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + items.push({ priceExponent: priceExponent, qtyExponent: qtyExponent, @@ -118,7 +124,8 @@ export class Ticker24hMiniResponseDecoder { closeTime: closeTime, firstId: firstId, lastId: lastId, - numTrades: numTrades + numTrades: numTrades, + symbol: symbol }); } diff --git a/binance/generated-typescript/spot_sbe/Ticker24hSymbolFullResponse.ts b/binance/generated-typescript/spot_sbe/Ticker24hSymbolFullResponse.ts index d6e4b6aaea..9291f42ab8 100644 --- a/binance/generated-typescript/spot_sbe/Ticker24hSymbolFullResponse.ts +++ b/binance/generated-typescript/spot_sbe/Ticker24hSymbolFullResponse.ts @@ -27,7 +27,7 @@ export interface Ticker24hSymbolFullResponse { firstId: bigint; lastId: bigint; numTrades: bigint; - symbol: Uint8Array; + symbol: string; } export class Ticker24hSymbolFullResponseDecoder { @@ -115,8 +115,10 @@ export class Ticker24hSymbolFullResponseDecoder { // Skip to end of block for forward compatibility pos = offset + Ticker24hSymbolFullResponseDecoder.BLOCK_LENGTH; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; return { priceExponent: priceExponent, @@ -141,22 +143,10 @@ export class Ticker24hSymbolFullResponseDecoder { firstId: firstId, lastId: lastId, numTrades: numTrades, - symbol: symbol.value + symbol: symbol }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return Ticker24hSymbolFullResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/Ticker24hSymbolMiniResponse.ts b/binance/generated-typescript/spot_sbe/Ticker24hSymbolMiniResponse.ts index 71d6a19b59..bb87abc89c 100644 --- a/binance/generated-typescript/spot_sbe/Ticker24hSymbolMiniResponse.ts +++ b/binance/generated-typescript/spot_sbe/Ticker24hSymbolMiniResponse.ts @@ -18,7 +18,7 @@ export interface Ticker24hSymbolMiniResponse { firstId: bigint; lastId: bigint; numTrades: bigint; - symbol: Uint8Array; + symbol: string; } export class Ticker24hSymbolMiniResponseDecoder { @@ -79,8 +79,10 @@ export class Ticker24hSymbolMiniResponseDecoder { // Skip to end of block for forward compatibility pos = offset + Ticker24hSymbolMiniResponseDecoder.BLOCK_LENGTH; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; return { priceExponent: priceExponent, @@ -96,22 +98,10 @@ export class Ticker24hSymbolMiniResponseDecoder { firstId: firstId, lastId: lastId, numTrades: numTrades, - symbol: symbol.value + symbol: symbol }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return Ticker24hSymbolMiniResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/TickerFullResponse.ts b/binance/generated-typescript/spot_sbe/TickerFullResponse.ts index 5bb72655a2..c97af60e9a 100644 --- a/binance/generated-typescript/spot_sbe/TickerFullResponse.ts +++ b/binance/generated-typescript/spot_sbe/TickerFullResponse.ts @@ -21,6 +21,7 @@ export interface Tickers { firstId: bigint; lastId: bigint; numTrades: bigint; + symbol: string; } export interface TickerFullResponse { @@ -114,9 +115,14 @@ export class TickerFullResponseDecoder { const numTrades = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + items.push({ priceExponent: priceExponent, qtyExponent: qtyExponent, @@ -133,7 +139,8 @@ export class TickerFullResponseDecoder { closeTime: closeTime, firstId: firstId, lastId: lastId, - numTrades: numTrades + numTrades: numTrades, + symbol: symbol }); } diff --git a/binance/generated-typescript/spot_sbe/TickerMiniResponse.ts b/binance/generated-typescript/spot_sbe/TickerMiniResponse.ts index 06b68a3422..4a5281f321 100644 --- a/binance/generated-typescript/spot_sbe/TickerMiniResponse.ts +++ b/binance/generated-typescript/spot_sbe/TickerMiniResponse.ts @@ -18,6 +18,7 @@ export interface Tickers { firstId: bigint; lastId: bigint; numTrades: bigint; + symbol: string; } export interface TickerMiniResponse { @@ -102,9 +103,14 @@ export class TickerMiniResponseDecoder { const numTrades = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; + items.push({ priceExponent: priceExponent, qtyExponent: qtyExponent, @@ -118,7 +124,8 @@ export class TickerMiniResponseDecoder { closeTime: closeTime, firstId: firstId, lastId: lastId, - numTrades: numTrades + numTrades: numTrades, + symbol: symbol }); } diff --git a/binance/generated-typescript/spot_sbe/TickerSymbolFullResponse.ts b/binance/generated-typescript/spot_sbe/TickerSymbolFullResponse.ts index cd495e605d..055803ef56 100644 --- a/binance/generated-typescript/spot_sbe/TickerSymbolFullResponse.ts +++ b/binance/generated-typescript/spot_sbe/TickerSymbolFullResponse.ts @@ -21,7 +21,7 @@ export interface TickerSymbolFullResponse { firstId: bigint; lastId: bigint; numTrades: bigint; - symbol: Uint8Array; + symbol: string; } export class TickerSymbolFullResponseDecoder { @@ -91,8 +91,10 @@ export class TickerSymbolFullResponseDecoder { // Skip to end of block for forward compatibility pos = offset + TickerSymbolFullResponseDecoder.BLOCK_LENGTH; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; return { priceExponent: priceExponent, @@ -111,22 +113,10 @@ export class TickerSymbolFullResponseDecoder { firstId: firstId, lastId: lastId, numTrades: numTrades, - symbol: symbol.value + symbol: symbol }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return TickerSymbolFullResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/TickerSymbolMiniResponse.ts b/binance/generated-typescript/spot_sbe/TickerSymbolMiniResponse.ts index a622c6a69a..83365248a3 100644 --- a/binance/generated-typescript/spot_sbe/TickerSymbolMiniResponse.ts +++ b/binance/generated-typescript/spot_sbe/TickerSymbolMiniResponse.ts @@ -18,7 +18,7 @@ export interface TickerSymbolMiniResponse { firstId: bigint; lastId: bigint; numTrades: bigint; - symbol: Uint8Array; + symbol: string; } export class TickerSymbolMiniResponseDecoder { @@ -79,8 +79,10 @@ export class TickerSymbolMiniResponseDecoder { // Skip to end of block for forward compatibility pos = offset + TickerSymbolMiniResponseDecoder.BLOCK_LENGTH; - const symbol = this.decodeVarData(view, pos); - pos = symbol.nextOffset; + const symbolLen = view.getUint8(pos); + pos += 1; + const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); + pos += symbolLen; return { priceExponent: priceExponent, @@ -96,22 +98,10 @@ export class TickerSymbolMiniResponseDecoder { firstId: firstId, lastId: lastId, numTrades: numTrades, - symbol: symbol.value + symbol: symbol }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return TickerSymbolMiniResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/TradesResponse.ts b/binance/generated-typescript/spot_sbe/TradesResponse.ts index 1bd2df1580..ebaf17829e 100644 --- a/binance/generated-typescript/spot_sbe/TradesResponse.ts +++ b/binance/generated-typescript/spot_sbe/TradesResponse.ts @@ -88,7 +88,7 @@ export class TradesResponseDecoder { const isBestMatch = view.getUint8(pos); pos += 1; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; items.push({ diff --git a/binance/generated-typescript/spot_sbe/UserDataStreamStartResponse.ts b/binance/generated-typescript/spot_sbe/UserDataStreamStartResponse.ts index 3f48855da7..636b09f4c1 100644 --- a/binance/generated-typescript/spot_sbe/UserDataStreamStartResponse.ts +++ b/binance/generated-typescript/spot_sbe/UserDataStreamStartResponse.ts @@ -5,7 +5,7 @@ */ export interface UserDataStreamStartResponse { - listenKey: Uint8Array; + listenKey: string; } export class UserDataStreamStartResponseDecoder { @@ -27,26 +27,16 @@ export class UserDataStreamStartResponseDecoder { // Skip to end of block for forward compatibility pos = offset + UserDataStreamStartResponseDecoder.BLOCK_LENGTH; - const listenKey = this.decodeVarData(view, pos); - pos = listenKey.nextOffset; + const listenKeyLen = view.getUint8(pos); + pos += 1; + const listenKey = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listenKeyLen)); + pos += listenKeyLen; return { - listenKey: listenKey.value + listenKey: listenKey }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return UserDataStreamStartResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/WebSocketResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketResponse.ts index 5c4e500e90..e548921d8d 100644 --- a/binance/generated-typescript/spot_sbe/WebSocketResponse.ts +++ b/binance/generated-typescript/spot_sbe/WebSocketResponse.ts @@ -16,7 +16,7 @@ export interface WebSocketResponse { sbeSchemaIdVersionDeprecated: number; status: number; rateLimits: RateLimits[]; - id: Uint8Array; + id: string; result: Uint8Array; } @@ -48,18 +48,22 @@ export class WebSocketResponseDecoder { const rateLimits = this.decodeRateLimitsGroup(view, pos); pos = rateLimits.nextOffset; - const id = this.decodeVarData(view, pos); - pos = id.nextOffset; + const idLen = view.getUint8(pos); + pos += 1; + const id = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, idLen)); + pos += idLen; - const result = this.decodeVarData(view, pos); - pos = result.nextOffset; + const resultLen = view.getUint32(pos, this.littleEndian); + pos += 4; + const result = new Uint8Array(view.buffer, view.byteOffset + pos, resultLen); + pos += resultLen; return { sbeSchemaIdVersionDeprecated: sbeSchemaIdVersionDeprecated, status: status, rateLimits: rateLimits.items, - id: id.value, - result: result.value + id: id, + result: result }; } private decodeRateLimitsGroup(view: DataView, offset: number): { items: RateLimits[], nextOffset: number } { @@ -90,7 +94,7 @@ export class WebSocketResponseDecoder { const current = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; items.push({ @@ -105,18 +109,6 @@ export class WebSocketResponseDecoder { return { items, nextOffset: pos }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return WebSocketResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/WebSocketSessionLogonResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketSessionLogonResponse.ts index 9c110de82c..53cd9f451e 100644 --- a/binance/generated-typescript/spot_sbe/WebSocketSessionLogonResponse.ts +++ b/binance/generated-typescript/spot_sbe/WebSocketSessionLogonResponse.ts @@ -10,7 +10,7 @@ export interface WebSocketSessionLogonResponse { returnRateLimits: number; serverTime: bigint; userDataStream: number; - loggedOnApiKey: Uint8Array; + loggedOnApiKey: string; } export class WebSocketSessionLogonResponseDecoder { @@ -47,8 +47,10 @@ export class WebSocketSessionLogonResponseDecoder { // Skip to end of block for forward compatibility pos = offset + WebSocketSessionLogonResponseDecoder.BLOCK_LENGTH; - const loggedOnApiKey = this.decodeVarData(view, pos); - pos = loggedOnApiKey.nextOffset; + const loggedOnApiKeyLen = view.getUint16(pos, this.littleEndian); + pos += 2; + const loggedOnApiKey = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, loggedOnApiKeyLen)); + pos += loggedOnApiKeyLen; return { authorizedSince: authorizedSince, @@ -56,22 +58,10 @@ export class WebSocketSessionLogonResponseDecoder { returnRateLimits: returnRateLimits, serverTime: serverTime, userDataStream: userDataStream, - loggedOnApiKey: loggedOnApiKey.value + loggedOnApiKey: loggedOnApiKey }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return WebSocketSessionLogonResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/WebSocketSessionLogoutResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketSessionLogoutResponse.ts index 566f0f52ad..f25befade7 100644 --- a/binance/generated-typescript/spot_sbe/WebSocketSessionLogoutResponse.ts +++ b/binance/generated-typescript/spot_sbe/WebSocketSessionLogoutResponse.ts @@ -10,7 +10,7 @@ export interface WebSocketSessionLogoutResponse { returnRateLimits: number; serverTime: bigint; userDataStream: number; - loggedOnApiKey: Uint8Array; + loggedOnApiKey: string; } export class WebSocketSessionLogoutResponseDecoder { @@ -47,8 +47,10 @@ export class WebSocketSessionLogoutResponseDecoder { // Skip to end of block for forward compatibility pos = offset + WebSocketSessionLogoutResponseDecoder.BLOCK_LENGTH; - const loggedOnApiKey = this.decodeVarData(view, pos); - pos = loggedOnApiKey.nextOffset; + const loggedOnApiKeyLen = view.getUint16(pos, this.littleEndian); + pos += 2; + const loggedOnApiKey = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, loggedOnApiKeyLen)); + pos += loggedOnApiKeyLen; return { authorizedSince: authorizedSince, @@ -56,22 +58,10 @@ export class WebSocketSessionLogoutResponseDecoder { returnRateLimits: returnRateLimits, serverTime: serverTime, userDataStream: userDataStream, - loggedOnApiKey: loggedOnApiKey.value + loggedOnApiKey: loggedOnApiKey }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return WebSocketSessionLogoutResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/WebSocketSessionStatusResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketSessionStatusResponse.ts index 224cdc8595..bbe6279acf 100644 --- a/binance/generated-typescript/spot_sbe/WebSocketSessionStatusResponse.ts +++ b/binance/generated-typescript/spot_sbe/WebSocketSessionStatusResponse.ts @@ -10,7 +10,7 @@ export interface WebSocketSessionStatusResponse { returnRateLimits: number; serverTime: bigint; userDataStream: number; - loggedOnApiKey: Uint8Array; + loggedOnApiKey: string; } export class WebSocketSessionStatusResponseDecoder { @@ -47,8 +47,10 @@ export class WebSocketSessionStatusResponseDecoder { // Skip to end of block for forward compatibility pos = offset + WebSocketSessionStatusResponseDecoder.BLOCK_LENGTH; - const loggedOnApiKey = this.decodeVarData(view, pos); - pos = loggedOnApiKey.nextOffset; + const loggedOnApiKeyLen = view.getUint16(pos, this.littleEndian); + pos += 2; + const loggedOnApiKey = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, loggedOnApiKeyLen)); + pos += loggedOnApiKeyLen; return { authorizedSince: authorizedSince, @@ -56,22 +58,10 @@ export class WebSocketSessionStatusResponseDecoder { returnRateLimits: returnRateLimits, serverTime: serverTime, userDataStream: userDataStream, - loggedOnApiKey: loggedOnApiKey.value + loggedOnApiKey: loggedOnApiKey }; } - private decodeVarData(view: DataView, offset: number): { value: Uint8Array, nextOffset: number } { - let pos = offset; - - const length = view.getUint32(pos, this.littleEndian); - pos += 4; - - const value = new Uint8Array(view.buffer, view.byteOffset + pos, length); - pos += length; - - return { value, nextOffset: pos }; - } - static getBlockLength(): number { return WebSocketSessionStatusResponseDecoder.BLOCK_LENGTH; } diff --git a/binance/generated-typescript/spot_sbe/WebSocketSessionSubscriptionsResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketSessionSubscriptionsResponse.ts index 0eee21185e..e81dcd5e31 100644 --- a/binance/generated-typescript/spot_sbe/WebSocketSessionSubscriptionsResponse.ts +++ b/binance/generated-typescript/spot_sbe/WebSocketSessionSubscriptionsResponse.ts @@ -58,7 +58,7 @@ export class WebSocketSessionSubscriptionsResponseDecoder { const expirationTime = view.getBigInt64(pos, this.littleEndian); pos += 8; - // Skip to next block for forward compatibility + // Skip to end of block for forward compatibility pos = itemStart + blockLength; items.push({ diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java index 4bd0362866..0af5c235d1 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/typescript/TypeScriptGenerator.java @@ -479,9 +479,6 @@ private void generateMessageDecoder( // Generate group decoder methods generateGroupDecoderMethods(sb, groups, messageName); - // Generate variable data decoder methods - generateVarDataDecoderMethods(sb, varData); - // Generate static methods sb.append("\n static getBlockLength(): number {\n"); sb.append(" return ").append(decoderName).append(".BLOCK_LENGTH;\n"); @@ -563,8 +560,8 @@ private void generateMessageInterface( final String fieldName = formatFieldName(varDataToken.name()); if (seenFieldNames.add(fieldName)) { - final Encoding encoding = varDataToken.encoding(); - final String characterEncoding = encoding.characterEncoding(); + final Token dataToken = Generators.findFirst("varData", varData, i); + final String characterEncoding = dataToken.encoding().characterEncoding(); if (null == characterEncoding) { @@ -696,49 +693,14 @@ private void generateDecodeMethod( if (seenFieldNames.add(fieldName)) { - final Encoding encoding = varDataToken.encoding(); - final String characterEncoding = encoding.characterEncoding(); - - if (null == characterEncoding) - { - sb.append(" const ").append(fieldName).append(" = this.decodeVarData(view, pos);\n"); - } - else if ("UTF-8".equals(characterEncoding)) - { - sb.append(" const ").append(fieldName).append(" = this.decodeVarStringUtf8(view, pos);\n"); - } - else - { - sb.append(" const ").append(fieldName).append(" = this.decodeVarStringAscii(view, pos);\n"); - } - - sb.append(" pos = ").append(fieldName).append(".nextOffset;\n\n"); - + generateInlineVarDataDecode(sb, " ", varData, i, fieldName, "this.littleEndian"); fieldNames.add(fieldName); - fieldValues.add(fieldName + ".value"); + fieldValues.add(fieldName); } else { - // Duplicate vardata - skip decoding - final Encoding encoding = varDataToken.encoding(); - final String characterEncoding = encoding.characterEncoding(); - - if (null == characterEncoding) - { - sb.append(" const ").append(fieldName).append("_dup = this.decodeVarData(view, pos);\n"); - } - else if ("UTF-8".equals(characterEncoding)) - { - sb.append(" const ").append(fieldName) - .append("_dup = this.decodeVarStringUtf8(view, pos);\n"); - } - else - { - sb.append(" const ").append(fieldName) - .append("_dup = this.decodeVarStringAscii(view, pos);\n"); - } - - sb.append(" pos = ").append(fieldName).append("_dup.nextOffset;\n\n"); + generateInlineVarDataDecode( + sb, " ", varData, i, fieldName + "_dup", "this.littleEndian"); } i += varDataToken.componentTokenCount(); @@ -781,21 +743,31 @@ private void generateGroupInterfaces(final StringBuilder sb, final List g if (groupToken.signal() == Signal.BEGIN_GROUP) { final String groupName = formatTypeName(groupToken.name()); - final List groupTokens = new ArrayList<>(); - final int endIndex = i + groupToken.componentTokenCount(); - for (int j = i; j < endIndex; j++) - { - groupTokens.add(groups.get(j)); - } - final List groupBody = groupTokens.subList(1, groupTokens.size() - 1); + // Parse group body: skip BEGIN_GROUP and END_GROUP, then skip dimension encoding + final List groupBody = groups.subList(i + 1, endIndex - 1); + final int dimHeaderLen = groupBody.get(0).componentTokenCount(); + + final List fields = new ArrayList<>(); + int idx = collectFields(groupBody, dimHeaderLen, fields); - // Generate group interface + final List nestedGroups = new ArrayList<>(); + idx = collectGroups(groupBody, idx, nestedGroups); + + final List varData = new ArrayList<>(); + collectVarData(groupBody, idx, varData); + + // Recursively generate interfaces for nested groups first + generateGroupInterfaces(sb, nestedGroups); + + // Generate this group's interface sb.append("export interface ").append(groupName).append(" {\n"); final java.util.Set seenFieldNames = new java.util.HashSet<>(); - Generators.forEachField(groupBody, (fieldToken, typeToken) -> + + // Fields + Generators.forEachField(fields, (fieldToken, typeToken) -> { final String fieldName = formatFieldName(fieldToken.name()); if (seenFieldNames.add(fieldName)) @@ -805,6 +777,55 @@ private void generateGroupInterfaces(final StringBuilder sb, final List g } }); + // Nested groups as arrays + for (int g = 0; g < nestedGroups.size();) + { + final Token nestedGroupToken = nestedGroups.get(g); + if (nestedGroupToken.signal() == Signal.BEGIN_GROUP) + { + final String nestedName = formatTypeName(nestedGroupToken.name()); + final String nestedField = formatFieldName(nestedGroupToken.name()); + if (seenFieldNames.add(nestedField)) + { + sb.append(" ").append(nestedField).append(": ") + .append(nestedName).append("[];\n"); + } + g += nestedGroupToken.componentTokenCount(); + } + else + { + g++; + } + } + + // Variable-length data + for (int v = 0; v < varData.size();) + { + final Token varDataToken = varData.get(v); + if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) + { + final String fieldName = formatFieldName(varDataToken.name()); + if (seenFieldNames.add(fieldName)) + { + final Token dataToken = Generators.findFirst("varData", varData, v); + final String charEnc = dataToken.encoding().characterEncoding(); + if (null == charEnc) + { + sb.append(" ").append(fieldName).append(": Uint8Array;\n"); + } + else + { + sb.append(" ").append(fieldName).append(": string;\n"); + } + } + v += varDataToken.componentTokenCount(); + } + else + { + v++; + } + } + sb.append("}\n\n"); i = endIndex; @@ -834,15 +855,21 @@ private void generateGroupDecoderMethods( if (groupToken.signal() == Signal.BEGIN_GROUP) { final String groupName = formatTypeName(groupToken.name()); - final List groupTokens = new ArrayList<>(); - final int endIndex = i + groupToken.componentTokenCount(); - for (int j = i; j < endIndex; j++) - { - groupTokens.add(groups.get(j)); - } - final List groupBody = groupTokens.subList(1, groupTokens.size() - 1); + // Parse group body: skip BEGIN_GROUP and END_GROUP, then skip dimension encoding + final List groupAllTokens = groups.subList(i, endIndex); + final List groupBody = groups.subList(i + 1, endIndex - 1); + final int dimHeaderLen = groupBody.get(0).componentTokenCount(); + + final List fields = new ArrayList<>(); + int idx = collectFields(groupBody, dimHeaderLen, fields); + + final List nestedGroups = new ArrayList<>(); + idx = collectGroups(groupBody, idx, nestedGroups); + + final List varData = new ArrayList<>(); + collectVarData(groupBody, idx, varData); // Generate group decoder method final String methodName = "decode" + groupName + "Group"; @@ -853,8 +880,8 @@ private void generateGroupDecoderMethods( sb.append(" let pos = offset;\n\n"); // Read group header - get dimension encoding from tokens - final Token blockLengthToken = Generators.findFirst("blockLength", groupTokens, 0); - final Token numInGroupToken = Generators.findFirst("numInGroup", groupTokens, 0); + final Token blockLengthToken = Generators.findFirst("blockLength", groupAllTokens, 0); + final Token numInGroupToken = Generators.findFirst("numInGroup", groupAllTokens, 0); final PrimitiveType blockLengthType = blockLengthToken.encoding().primitiveType(); final PrimitiveType numInGroupType = numInGroupToken.encoding().primitiveType(); @@ -881,12 +908,12 @@ private void generateGroupDecoderMethods( sb.append(" for (let i = 0; i < numInGroup; i++) {\n"); sb.append(" const itemStart = pos;\n\n"); - // Decode group fields + // Decode group fixed fields final List groupFieldNames = new ArrayList<>(); final List groupFieldValues = new ArrayList<>(); final java.util.Set seenFieldNames = new java.util.HashSet<>(); - Generators.forEachField(groupBody, (fieldToken, typeToken) -> + Generators.forEachField(fields, (fieldToken, typeToken) -> { final String fieldName = formatFieldName(fieldToken.name()); @@ -895,10 +922,10 @@ private void generateGroupDecoderMethods( groupFieldNames.add(fieldName); final PrimitiveType primitiveType = typeToken.encoding().primitiveType(); - final String dataViewMethod = dataViewMethod(primitiveType); + final String dvMethod = dataViewMethod(primitiveType); sb.append(" const ").append(fieldName).append(" = view.") - .append(dataViewMethod).append("(pos"); + .append(dvMethod).append("(pos"); if (needsEndianness(primitiveType)) { @@ -912,20 +939,77 @@ private void generateGroupDecoderMethods( } else { - // Skip duplicate field - just advance position sb.append(" pos += ").append(typeToken.encodedLength()).append(";\n\n"); } }); - // Skip to next block for forward compatibility - sb.append(" // Skip to next block for forward compatibility\n"); + // Skip to end of fixed block for forward compatibility + sb.append(" // Skip to end of block for forward compatibility\n"); sb.append(" pos = itemStart + blockLength;\n\n"); + // Decode nested groups (after fixed block) + for (int g = 0; g < nestedGroups.size();) + { + final Token nestedToken = nestedGroups.get(g); + if (nestedToken.signal() == Signal.BEGIN_GROUP) + { + final String nestedName = formatTypeName(nestedToken.name()); + final String nestedField = formatFieldName(nestedToken.name()); + + if (seenFieldNames.add(nestedField)) + { + final String nestedMethod = "decode" + nestedName + "Group"; + sb.append(" const ").append(nestedField) + .append(" = this.").append(nestedMethod).append("(view, pos);\n"); + sb.append(" pos = ").append(nestedField).append(".nextOffset;\n\n"); + + groupFieldNames.add(nestedField); + groupFieldValues.add(nestedField + ".items"); + } + + g += nestedToken.componentTokenCount(); + } + else + { + g++; + } + } + + // Decode variable-length data (after nested groups) + for (int v = 0; v < varData.size();) + { + final Token varDataToken = varData.get(v); + if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) + { + final String fieldName = formatFieldName(varDataToken.name()); + + if (seenFieldNames.add(fieldName)) + { + generateInlineVarDataDecode( + sb, " ", varData, v, fieldName, "this.littleEndian"); + groupFieldNames.add(fieldName); + groupFieldValues.add(fieldName); + } + else + { + generateInlineVarDataDecode( + sb, " ", varData, v, fieldName + "_dup", "this.littleEndian"); + } + + v += varDataToken.componentTokenCount(); + } + else + { + v++; + } + } + // Add item to array sb.append(" items.push({\n"); for (int k = 0; k < groupFieldNames.size(); k++) { - sb.append(" ").append(groupFieldNames.get(k)).append(": ").append(groupFieldValues.get(k)); + sb.append(" ").append(groupFieldNames.get(k)) + .append(": ").append(groupFieldValues.get(k)); if (k < groupFieldNames.size() - 1) { sb.append(",\n"); @@ -942,6 +1026,9 @@ private void generateGroupDecoderMethods( sb.append(" return { items, nextOffset: pos };\n"); sb.append(" }\n"); + // Recursively generate decoder methods for nested groups + generateGroupDecoderMethods(sb, nestedGroups, parentName); + i = endIndex; } else @@ -952,85 +1039,51 @@ private void generateGroupDecoderMethods( } /** - * Generate variable-length data decoder methods. + * Generate inline variable-length data decode code. * - * @param sb to append to. - * @param varData the variable-length data tokens. + * @param sb to append to. + * @param indent indentation prefix. + * @param varDataTokens the variable-length data tokens. + * @param startIndex index of the BEGIN_VAR_DATA token. + * @param fieldName the field name to use in generated code. + * @param endianRef the endianness reference (e.g. "this.littleEndian" or "littleEndian"). */ - private void generateVarDataDecoderMethods(final StringBuilder sb, final List varData) + private void generateInlineVarDataDecode( + final StringBuilder sb, + final String indent, + final List varDataTokens, + final int startIndex, + final String fieldName, + final String endianRef) { - boolean needsVarDataDecoder = false; - boolean needsUtf8Decoder = false; - boolean needsAsciiDecoder = false; - - for (int i = 0; i < varData.size();) + final Token lengthToken = Generators.findFirst("length", varDataTokens, startIndex); + final Token dataToken = Generators.findFirst("varData", varDataTokens, startIndex); + final PrimitiveType lengthType = lengthToken.encoding().primitiveType(); + final String characterEncoding = dataToken.encoding().characterEncoding(); + + sb.append(indent).append("const ").append(fieldName).append("Len = view.") + .append(dataViewMethod(lengthType)).append("(pos"); + if (needsEndianness(lengthType)) { - final Token varDataToken = varData.get(i); - if (varDataToken.signal() == Signal.BEGIN_VAR_DATA) - { - final Encoding encoding = varDataToken.encoding(); - final String characterEncoding = encoding.characterEncoding(); - - if (null == characterEncoding) - { - needsVarDataDecoder = true; - } - else if ("UTF-8".equals(characterEncoding)) - { - needsUtf8Decoder = true; - } - else - { - needsAsciiDecoder = true; - } - - i += varDataToken.componentTokenCount(); - } - else - { - i++; - } + sb.append(", ").append(endianRef); } + sb.append(");\n"); + sb.append(indent).append("pos += ").append(lengthToken.encodedLength()).append(";\n"); - if (needsVarDataDecoder) + if (null != characterEncoding) { - sb.append("\n private decodeVarData(view: DataView, offset: number): ") - .append("{ value: Uint8Array, nextOffset: number } {\n"); - sb.append(" let pos = offset;\n\n"); - sb.append(" const length = view.getUint32(pos, this.littleEndian);\n"); - sb.append(" pos += 4;\n\n"); - sb.append(" const value = new Uint8Array(view.buffer, view.byteOffset + pos, length);\n"); - sb.append(" pos += length;\n\n"); - sb.append(" return { value, nextOffset: pos };\n"); - sb.append(" }\n"); + final String tsEncoding = "UTF-8".equals(characterEncoding) ? "utf-8" : "ascii"; + sb.append(indent).append("const ").append(fieldName) + .append(" = new TextDecoder('").append(tsEncoding).append("')") + .append(".decode(new Uint8Array(view.buffer, view.byteOffset + pos, ") + .append(fieldName).append("Len));\n"); } - - if (needsUtf8Decoder) + else { - sb.append("\n private decodeVarStringUtf8(view: DataView, offset: number): ") - .append("{ value: string, nextOffset: number } {\n"); - sb.append(" let pos = offset;\n\n"); - sb.append(" const length = view.getUint32(pos, this.littleEndian);\n"); - sb.append(" pos += 4;\n\n"); - sb.append(" const bytes = new Uint8Array(view.buffer, view.byteOffset + pos, length);\n"); - sb.append(" const value = new TextDecoder('utf-8').decode(bytes);\n"); - sb.append(" pos += length;\n\n"); - sb.append(" return { value, nextOffset: pos };\n"); - sb.append(" }\n"); - } - - if (needsAsciiDecoder) - { - sb.append("\n private decodeVarStringAscii(view: DataView, offset: number): ") - .append("{ value: string, nextOffset: number } {\n"); - sb.append(" let pos = offset;\n\n"); - sb.append(" const length = view.getUint32(pos, this.littleEndian);\n"); - sb.append(" pos += 4;\n\n"); - sb.append(" const bytes = new Uint8Array(view.buffer, view.byteOffset + pos, length);\n"); - sb.append(" const value = new TextDecoder('ascii').decode(bytes);\n"); - sb.append(" pos += length;\n\n"); - sb.append(" return { value, nextOffset: pos };\n"); - sb.append(" }\n"); + sb.append(indent).append("const ").append(fieldName) + .append(" = new Uint8Array(view.buffer, view.byteOffset + pos, ") + .append(fieldName).append("Len);\n"); } + sb.append(indent).append("pos += ").append(fieldName).append("Len;\n\n"); } } From 5fd504f80662cb49bffe1be39aacccc1a115c061 Mon Sep 17 00:00:00 2001 From: Pablo Date: Sun, 8 Mar 2026 20:22:35 -0400 Subject: [PATCH 11/11] remove binance generated files --- .../spot_sbe/AccountAllocationsResponse.ts | 184 ------- .../spot_sbe/AccountCommissionResponse.ts | 147 ----- .../spot_sbe/AccountOrderRateLimitResponse.ts | 103 ---- .../AccountPreventedMatchesResponse.ts | 147 ----- .../spot_sbe/AccountResponse.ts | 249 --------- .../spot_sbe/AccountTradesResponse.ts | 162 ------ .../spot_sbe/AccountType.ts | 11 - .../spot_sbe/AggTradesResponse.ts | 128 ----- .../spot_sbe/AllocationType.ts | 11 - .../AllowedSelfTradePreventionModes.ts | 35 -- .../spot_sbe/AveragePriceResponse.ts | 68 --- .../spot_sbe/BalanceUpdateEvent.ts | 80 --- .../spot_sbe/BookTickerResponse.ts | 115 ---- .../spot_sbe/BookTickerSymbolResponse.ts | 85 --- .../generated-typescript/spot_sbe/BoolEnum.ts | 10 - .../spot_sbe/CancelOpenOrdersResponse.ts | 85 --- .../spot_sbe/CancelOrderListResponse.ts | 332 ------------ .../spot_sbe/CancelOrderResponse.ts | 214 -------- .../spot_sbe/CancelReplaceOrderResponse.ts | 72 --- .../spot_sbe/CancelReplaceStatus.ts | 12 - .../spot_sbe/ContingencyType.ts | 11 - .../spot_sbe/DepthResponse.ts | 143 ----- .../spot_sbe/ErrorResponse.ts | 77 --- .../spot_sbe/EventStreamTerminatedEvent.ts | 58 -- .../spot_sbe/ExchangeInfoResponse.ts | 454 ---------------- .../ExchangeMaxNumAlgoOrdersFilter.ts | 58 -- .../ExchangeMaxNumIcebergOrdersFilter.ts | 58 -- .../ExchangeMaxNumOrderListsFilter.ts | 58 -- .../spot_sbe/ExchangeMaxNumOrdersFilter.ts | 58 -- .../spot_sbe/ExecutionReportEvent.ts | 355 ------------- .../spot_sbe/ExecutionType.ts | 17 - .../spot_sbe/ExternalLockUpdateEvent.ts | 80 --- .../spot_sbe/FilterType.ts | 30 -- .../generated-typescript/spot_sbe/Floor.ts | 12 - .../spot_sbe/GroupSize16Encoding.ts | 33 -- .../spot_sbe/GroupSizeEncoding.ts | 33 -- .../spot_sbe/IcebergPartsFilter.ts | 58 -- .../spot_sbe/KlinesResponse.ts | 143 ----- .../spot_sbe/ListOrderStatus.ts | 13 - .../spot_sbe/ListStatusEvent.ts | 153 ------ .../spot_sbe/ListStatusType.ts | 13 - .../spot_sbe/LotSizeFilter.ts | 73 --- .../spot_sbe/MarketLotSizeFilter.ts | 73 --- .../spot_sbe/MatchType.ts | 11 - .../spot_sbe/MaxAssetFilter.ts | 70 --- .../spot_sbe/MaxNumAlgoOrdersFilter.ts | 58 -- .../spot_sbe/MaxNumIcebergOrdersFilter.ts | 58 -- .../spot_sbe/MaxNumOrderAmendsFilter.ts | 58 -- .../spot_sbe/MaxNumOrderListsFilter.ts | 58 -- .../spot_sbe/MaxNumOrdersFilter.ts | 58 -- .../spot_sbe/MaxPositionFilter.ts | 63 --- .../spot_sbe/MessageData.ts | 33 -- .../spot_sbe/MessageData16.ts | 33 -- .../spot_sbe/MessageData8.ts | 33 -- .../spot_sbe/MessageHeader.ts | 43 -- .../spot_sbe/MinNotionalFilter.ts | 73 --- .../spot_sbe/MyFiltersResponse.ts | 159 ------ .../spot_sbe/NewOrderAckResponse.ts | 77 --- .../spot_sbe/NewOrderFullResponse.ts | 351 ------------ .../spot_sbe/NewOrderListAckResponse.ts | 195 ------- .../spot_sbe/NewOrderListFullResponse.ts | 469 ---------------- .../spot_sbe/NewOrderListResultResponse.ts | 335 ------------ .../spot_sbe/NewOrderResultResponse.ts | 217 -------- .../spot_sbe/NonRepresentableMessage.ts | 48 -- .../spot_sbe/NotionalFilter.ts | 83 --- .../spot_sbe/OptionalMessageData.ts | 33 -- .../spot_sbe/OptionalMessageData16.ts | 33 -- .../spot_sbe/OptionalVarString.ts | 33 -- .../spot_sbe/OptionalVarString8.ts | 33 -- .../OrderAmendKeepPriorityResponse.ts | 501 ------------------ .../spot_sbe/OrderAmendmentsResponse.ts | 129 ----- .../spot_sbe/OrderCapacity.ts | 11 - .../spot_sbe/OrderListResponse.ts | 136 ----- .../spot_sbe/OrderListsResponse.ts | 166 ------ .../spot_sbe/OrderResponse.ts | 227 -------- .../spot_sbe/OrderSide.ts | 11 - .../spot_sbe/OrderStatus.ts | 19 - .../spot_sbe/OrderTestResponse.ts | 48 -- .../OrderTestWithCommissionsResponse.ts | 110 ---- .../spot_sbe/OrderType.ts | 16 - .../spot_sbe/OrderTypes.ts | 37 -- .../spot_sbe/OrdersResponse.ts | 257 --------- .../spot_sbe/OutboundAccountPositionEvent.ts | 115 ---- .../spot_sbe/PegOffsetType.ts | 10 - .../spot_sbe/PegPriceType.ts | 11 - .../spot_sbe/PercentPriceBySideFilter.ts | 83 --- .../spot_sbe/PercentPriceFilter.ts | 73 --- .../spot_sbe/PingResponse.ts | 48 -- .../spot_sbe/PriceFilter.ts | 73 --- .../spot_sbe/PriceTickerResponse.ts | 95 ---- .../spot_sbe/PriceTickerSymbolResponse.ts | 65 --- .../spot_sbe/RateLimitInterval.ts | 13 - .../spot_sbe/RateLimitType.ts | 13 - .../spot_sbe/SelfTradePreventionMode.ts | 15 - .../spot_sbe/ServerTimeResponse.ts | 53 -- .../spot_sbe/SymbolStatus.ts | 13 - .../spot_sbe/TPlusFilterLockEvent.ts | 117 ---- .../spot_sbe/TPlusSellFilter.ts | 58 -- .../spot_sbe/Ticker24hFullResponse.ts | 195 ------- .../spot_sbe/Ticker24hMiniResponse.ts | 150 ------ .../spot_sbe/Ticker24hSymbolFullResponse.ts | 165 ------ .../spot_sbe/Ticker24hSymbolMiniResponse.ts | 120 ----- .../spot_sbe/TickerFullResponse.ts | 165 ------ .../spot_sbe/TickerMiniResponse.ts | 150 ------ .../spot_sbe/TickerSymbolFullResponse.ts | 135 ----- .../spot_sbe/TickerSymbolMiniResponse.ts | 120 ----- .../spot_sbe/TimeInForce.ts | 12 - .../spot_sbe/TradesResponse.ts | 123 ----- .../spot_sbe/TrailingDeltaFilter.ts | 73 --- .../spot_sbe/UserDataStreamPingResponse.ts | 48 -- .../spot_sbe/UserDataStreamStartResponse.ts | 55 -- .../spot_sbe/UserDataStreamStopResponse.ts | 48 -- ...rDataStreamSubscribeListenTokenResponse.ts | 58 -- .../UserDataStreamSubscribeResponse.ts | 53 -- .../UserDataStreamUnsubscribeResponse.ts | 48 -- .../spot_sbe/VarString.ts | 33 -- .../spot_sbe/VarString8.ts | 33 -- .../spot_sbe/WebSocketResponse.ts | 127 ----- .../spot_sbe/WebSocketSessionLogonResponse.ts | 80 --- .../WebSocketSessionLogoutResponse.ts | 80 --- .../WebSocketSessionStatusResponse.ts | 80 --- .../WebSocketSessionSubscriptionsResponse.ts | 88 --- .../generated-typescript/spot_sbe/index.ts | 128 ----- 123 files changed, 11916 deletions(-) delete mode 100644 binance/generated-typescript/spot_sbe/AccountAllocationsResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/AccountCommissionResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/AccountOrderRateLimitResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/AccountPreventedMatchesResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/AccountResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/AccountTradesResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/AccountType.ts delete mode 100644 binance/generated-typescript/spot_sbe/AggTradesResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/AllocationType.ts delete mode 100644 binance/generated-typescript/spot_sbe/AllowedSelfTradePreventionModes.ts delete mode 100644 binance/generated-typescript/spot_sbe/AveragePriceResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/BalanceUpdateEvent.ts delete mode 100644 binance/generated-typescript/spot_sbe/BookTickerResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/BookTickerSymbolResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/BoolEnum.ts delete mode 100644 binance/generated-typescript/spot_sbe/CancelOpenOrdersResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/CancelOrderListResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/CancelOrderResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/CancelReplaceOrderResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/CancelReplaceStatus.ts delete mode 100644 binance/generated-typescript/spot_sbe/ContingencyType.ts delete mode 100644 binance/generated-typescript/spot_sbe/DepthResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/ErrorResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/EventStreamTerminatedEvent.ts delete mode 100644 binance/generated-typescript/spot_sbe/ExchangeInfoResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/ExchangeMaxNumAlgoOrdersFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/ExchangeMaxNumIcebergOrdersFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/ExchangeMaxNumOrderListsFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/ExchangeMaxNumOrdersFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/ExecutionReportEvent.ts delete mode 100644 binance/generated-typescript/spot_sbe/ExecutionType.ts delete mode 100644 binance/generated-typescript/spot_sbe/ExternalLockUpdateEvent.ts delete mode 100644 binance/generated-typescript/spot_sbe/FilterType.ts delete mode 100644 binance/generated-typescript/spot_sbe/Floor.ts delete mode 100644 binance/generated-typescript/spot_sbe/GroupSize16Encoding.ts delete mode 100644 binance/generated-typescript/spot_sbe/GroupSizeEncoding.ts delete mode 100644 binance/generated-typescript/spot_sbe/IcebergPartsFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/KlinesResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/ListOrderStatus.ts delete mode 100644 binance/generated-typescript/spot_sbe/ListStatusEvent.ts delete mode 100644 binance/generated-typescript/spot_sbe/ListStatusType.ts delete mode 100644 binance/generated-typescript/spot_sbe/LotSizeFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/MarketLotSizeFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/MatchType.ts delete mode 100644 binance/generated-typescript/spot_sbe/MaxAssetFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/MaxNumAlgoOrdersFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/MaxNumIcebergOrdersFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/MaxNumOrderAmendsFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/MaxNumOrderListsFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/MaxNumOrdersFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/MaxPositionFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/MessageData.ts delete mode 100644 binance/generated-typescript/spot_sbe/MessageData16.ts delete mode 100644 binance/generated-typescript/spot_sbe/MessageData8.ts delete mode 100644 binance/generated-typescript/spot_sbe/MessageHeader.ts delete mode 100644 binance/generated-typescript/spot_sbe/MinNotionalFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/MyFiltersResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/NewOrderAckResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/NewOrderFullResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/NewOrderListAckResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/NewOrderListFullResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/NewOrderListResultResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/NewOrderResultResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/NonRepresentableMessage.ts delete mode 100644 binance/generated-typescript/spot_sbe/NotionalFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/OptionalMessageData.ts delete mode 100644 binance/generated-typescript/spot_sbe/OptionalMessageData16.ts delete mode 100644 binance/generated-typescript/spot_sbe/OptionalVarString.ts delete mode 100644 binance/generated-typescript/spot_sbe/OptionalVarString8.ts delete mode 100644 binance/generated-typescript/spot_sbe/OrderAmendKeepPriorityResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/OrderAmendmentsResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/OrderCapacity.ts delete mode 100644 binance/generated-typescript/spot_sbe/OrderListResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/OrderListsResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/OrderResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/OrderSide.ts delete mode 100644 binance/generated-typescript/spot_sbe/OrderStatus.ts delete mode 100644 binance/generated-typescript/spot_sbe/OrderTestResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/OrderTestWithCommissionsResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/OrderType.ts delete mode 100644 binance/generated-typescript/spot_sbe/OrderTypes.ts delete mode 100644 binance/generated-typescript/spot_sbe/OrdersResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/OutboundAccountPositionEvent.ts delete mode 100644 binance/generated-typescript/spot_sbe/PegOffsetType.ts delete mode 100644 binance/generated-typescript/spot_sbe/PegPriceType.ts delete mode 100644 binance/generated-typescript/spot_sbe/PercentPriceBySideFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/PercentPriceFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/PingResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/PriceFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/PriceTickerResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/PriceTickerSymbolResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/RateLimitInterval.ts delete mode 100644 binance/generated-typescript/spot_sbe/RateLimitType.ts delete mode 100644 binance/generated-typescript/spot_sbe/SelfTradePreventionMode.ts delete mode 100644 binance/generated-typescript/spot_sbe/ServerTimeResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/SymbolStatus.ts delete mode 100644 binance/generated-typescript/spot_sbe/TPlusFilterLockEvent.ts delete mode 100644 binance/generated-typescript/spot_sbe/TPlusSellFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/Ticker24hFullResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/Ticker24hMiniResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/Ticker24hSymbolFullResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/Ticker24hSymbolMiniResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/TickerFullResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/TickerMiniResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/TickerSymbolFullResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/TickerSymbolMiniResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/TimeInForce.ts delete mode 100644 binance/generated-typescript/spot_sbe/TradesResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/TrailingDeltaFilter.ts delete mode 100644 binance/generated-typescript/spot_sbe/UserDataStreamPingResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/UserDataStreamStartResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/UserDataStreamStopResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/UserDataStreamSubscribeListenTokenResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/UserDataStreamSubscribeResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/UserDataStreamUnsubscribeResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/VarString.ts delete mode 100644 binance/generated-typescript/spot_sbe/VarString8.ts delete mode 100644 binance/generated-typescript/spot_sbe/WebSocketResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/WebSocketSessionLogonResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/WebSocketSessionLogoutResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/WebSocketSessionStatusResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/WebSocketSessionSubscriptionsResponse.ts delete mode 100644 binance/generated-typescript/spot_sbe/index.ts diff --git a/binance/generated-typescript/spot_sbe/AccountAllocationsResponse.ts b/binance/generated-typescript/spot_sbe/AccountAllocationsResponse.ts deleted file mode 100644 index 1cec71c90c..0000000000 --- a/binance/generated-typescript/spot_sbe/AccountAllocationsResponse.ts +++ /dev/null @@ -1,184 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Allocations { - priceExponent: number; - qtyExponent: number; - commissionExponent: number; - allocationId: bigint; - allocationType: number; - orderId: bigint; - orderListId: bigint; - sourceTradeId: bigint; - sourceAllocationId: bigint; - price: bigint; - qty: bigint; - quoteQty: bigint; - commission: bigint; - time: bigint; - isBuyer: number; - isMaker: number; - isAllocator: number; - symbol: string; - commissionAsset: string; - sourceSymbol: string; -} - -export interface AccountAllocationsResponse { - allocations: Allocations[]; -} - -export class AccountAllocationsResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 404; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): AccountAllocationsResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + AccountAllocationsResponseDecoder.BLOCK_LENGTH; - - const allocations = this.decodeAllocationsGroup(view, pos); - pos = allocations.nextOffset; - - return { - allocations: allocations.items - }; - } - private decodeAllocationsGroup(view: DataView, offset: number): { items: Allocations[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Allocations[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const commissionExponent = view.getInt8(pos); - pos += 1; - - const allocationId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const allocationType = view.getUint8(pos); - pos += 1; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const sourceTradeId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const sourceAllocationId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const quoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const commission = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const time = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const isBuyer = view.getUint8(pos); - pos += 1; - - const isMaker = view.getUint8(pos); - pos += 1; - - const isAllocator = view.getUint8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const commissionAssetLen = view.getUint8(pos); - pos += 1; - const commissionAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, commissionAssetLen)); - pos += commissionAssetLen; - - const sourceSymbolLen = view.getUint8(pos); - pos += 1; - const sourceSymbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, sourceSymbolLen)); - pos += sourceSymbolLen; - - items.push({ - priceExponent: priceExponent, - qtyExponent: qtyExponent, - commissionExponent: commissionExponent, - allocationId: allocationId, - allocationType: allocationType, - orderId: orderId, - orderListId: orderListId, - sourceTradeId: sourceTradeId, - sourceAllocationId: sourceAllocationId, - price: price, - qty: qty, - quoteQty: quoteQty, - commission: commission, - time: time, - isBuyer: isBuyer, - isMaker: isMaker, - isAllocator: isAllocator, - symbol: symbol, - commissionAsset: commissionAsset, - sourceSymbol: sourceSymbol - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return AccountAllocationsResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return AccountAllocationsResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return AccountAllocationsResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return AccountAllocationsResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/AccountCommissionResponse.ts b/binance/generated-typescript/spot_sbe/AccountCommissionResponse.ts deleted file mode 100644 index b9c0bd2d2b..0000000000 --- a/binance/generated-typescript/spot_sbe/AccountCommissionResponse.ts +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface AccountCommissionResponse { - commissionExponent: number; - discountExponent: number; - standardCommissionMaker: bigint; - standardCommissionTaker: bigint; - standardCommissionBuyer: bigint; - standardCommissionSeller: bigint; - taxCommissionMaker: bigint; - taxCommissionTaker: bigint; - taxCommissionBuyer: bigint; - taxCommissionSeller: bigint; - discountEnabledForAccount: number; - discountEnabledForSymbol: number; - discount: bigint; - specialCommissionMaker: bigint; - specialCommissionTaker: bigint; - specialCommissionBuyer: bigint; - specialCommissionSeller: bigint; - symbol: string; - discountAsset: string; -} - -export class AccountCommissionResponseDecoder { - private static readonly BLOCK_LENGTH = 108; - private static readonly TEMPLATE_ID = 405; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): AccountCommissionResponse { - const view = new DataView(buffer); - let pos = offset; - - const commissionExponent = view.getInt8(pos); - pos += 1; - - const discountExponent = view.getInt8(pos); - pos += 1; - - const standardCommissionMaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const standardCommissionTaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const standardCommissionBuyer = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const standardCommissionSeller = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const taxCommissionMaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const taxCommissionTaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const taxCommissionBuyer = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const taxCommissionSeller = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const discountEnabledForAccount = view.getUint8(pos); - pos += 1; - - const discountEnabledForSymbol = view.getUint8(pos); - pos += 1; - - const discount = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const specialCommissionMaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const specialCommissionTaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const specialCommissionBuyer = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const specialCommissionSeller = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + AccountCommissionResponseDecoder.BLOCK_LENGTH; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const discountAssetLen = view.getUint8(pos); - pos += 1; - const discountAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, discountAssetLen)); - pos += discountAssetLen; - - return { - commissionExponent: commissionExponent, - discountExponent: discountExponent, - standardCommissionMaker: standardCommissionMaker, - standardCommissionTaker: standardCommissionTaker, - standardCommissionBuyer: standardCommissionBuyer, - standardCommissionSeller: standardCommissionSeller, - taxCommissionMaker: taxCommissionMaker, - taxCommissionTaker: taxCommissionTaker, - taxCommissionBuyer: taxCommissionBuyer, - taxCommissionSeller: taxCommissionSeller, - discountEnabledForAccount: discountEnabledForAccount, - discountEnabledForSymbol: discountEnabledForSymbol, - discount: discount, - specialCommissionMaker: specialCommissionMaker, - specialCommissionTaker: specialCommissionTaker, - specialCommissionBuyer: specialCommissionBuyer, - specialCommissionSeller: specialCommissionSeller, - symbol: symbol, - discountAsset: discountAsset - }; - } - - static getBlockLength(): number { - return AccountCommissionResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return AccountCommissionResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return AccountCommissionResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return AccountCommissionResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/AccountOrderRateLimitResponse.ts b/binance/generated-typescript/spot_sbe/AccountOrderRateLimitResponse.ts deleted file mode 100644 index a67f354350..0000000000 --- a/binance/generated-typescript/spot_sbe/AccountOrderRateLimitResponse.ts +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface RateLimits { - rateLimitType: number; - interval: number; - intervalNum: number; - rateLimit: bigint; - numOrders: bigint; -} - -export interface AccountOrderRateLimitResponse { - rateLimits: RateLimits[]; -} - -export class AccountOrderRateLimitResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 402; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): AccountOrderRateLimitResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + AccountOrderRateLimitResponseDecoder.BLOCK_LENGTH; - - const rateLimits = this.decodeRateLimitsGroup(view, pos); - pos = rateLimits.nextOffset; - - return { - rateLimits: rateLimits.items - }; - } - private decodeRateLimitsGroup(view: DataView, offset: number): { items: RateLimits[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: RateLimits[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const rateLimitType = view.getUint8(pos); - pos += 1; - - const interval = view.getUint8(pos); - pos += 1; - - const intervalNum = view.getUint8(pos); - pos += 1; - - const rateLimit = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const numOrders = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - items.push({ - rateLimitType: rateLimitType, - interval: interval, - intervalNum: intervalNum, - rateLimit: rateLimit, - numOrders: numOrders - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return AccountOrderRateLimitResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return AccountOrderRateLimitResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return AccountOrderRateLimitResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return AccountOrderRateLimitResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/AccountPreventedMatchesResponse.ts b/binance/generated-typescript/spot_sbe/AccountPreventedMatchesResponse.ts deleted file mode 100644 index 46774fa0b1..0000000000 --- a/binance/generated-typescript/spot_sbe/AccountPreventedMatchesResponse.ts +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface PreventedMatches { - priceExponent: number; - qtyExponent: number; - preventedMatchId: bigint; - takerOrderId: bigint; - makerOrderId: bigint; - tradeGroupId: bigint; - selfTradePreventionMode: number; - price: bigint; - takerPreventedQuantity: bigint; - makerPreventedQuantity: bigint; - transactTime: bigint; - symbol: string; - makerSymbol: string; -} - -export interface AccountPreventedMatchesResponse { - preventedMatches: PreventedMatches[]; -} - -export class AccountPreventedMatchesResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 403; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): AccountPreventedMatchesResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + AccountPreventedMatchesResponseDecoder.BLOCK_LENGTH; - - const preventedMatches = this.decodePreventedMatchesGroup(view, pos); - pos = preventedMatches.nextOffset; - - return { - preventedMatches: preventedMatches.items - }; - } - private decodePreventedMatchesGroup(view: DataView, offset: number): { items: PreventedMatches[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: PreventedMatches[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const preventedMatchId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const takerOrderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const makerOrderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const tradeGroupId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const selfTradePreventionMode = view.getUint8(pos); - pos += 1; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const takerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const makerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const transactTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const makerSymbolLen = view.getUint8(pos); - pos += 1; - const makerSymbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, makerSymbolLen)); - pos += makerSymbolLen; - - items.push({ - priceExponent: priceExponent, - qtyExponent: qtyExponent, - preventedMatchId: preventedMatchId, - takerOrderId: takerOrderId, - makerOrderId: makerOrderId, - tradeGroupId: tradeGroupId, - selfTradePreventionMode: selfTradePreventionMode, - price: price, - takerPreventedQuantity: takerPreventedQuantity, - makerPreventedQuantity: makerPreventedQuantity, - transactTime: transactTime, - symbol: symbol, - makerSymbol: makerSymbol - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return AccountPreventedMatchesResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return AccountPreventedMatchesResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return AccountPreventedMatchesResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return AccountPreventedMatchesResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/AccountResponse.ts b/binance/generated-typescript/spot_sbe/AccountResponse.ts deleted file mode 100644 index 0441ee80af..0000000000 --- a/binance/generated-typescript/spot_sbe/AccountResponse.ts +++ /dev/null @@ -1,249 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Balances { - exponent: number; - free: bigint; - locked: bigint; - asset: string; -} - -export interface Permissions { - permission: string; -} - -export interface ReduceOnlyAssets { - asset: string; -} - -export interface AccountResponse { - commissionExponent: number; - commissionRateMaker: bigint; - commissionRateTaker: bigint; - commissionRateBuyer: bigint; - commissionRateSeller: bigint; - canTrade: number; - canWithdraw: number; - canDeposit: number; - brokered: number; - requireSelfTradePrevention: number; - preventSor: number; - updateTime: bigint; - accountType: number; - tradeGroupId: bigint; - uid: bigint; - balances: Balances[]; - permissions: Permissions[]; - reduceOnlyAssets: ReduceOnlyAssets[]; -} - -export class AccountResponseDecoder { - private static readonly BLOCK_LENGTH = 64; - private static readonly TEMPLATE_ID = 400; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): AccountResponse { - const view = new DataView(buffer); - let pos = offset; - - const commissionExponent = view.getInt8(pos); - pos += 1; - - const commissionRateMaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const commissionRateTaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const commissionRateBuyer = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const commissionRateSeller = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const canTrade = view.getUint8(pos); - pos += 1; - - const canWithdraw = view.getUint8(pos); - pos += 1; - - const canDeposit = view.getUint8(pos); - pos += 1; - - const brokered = view.getUint8(pos); - pos += 1; - - const requireSelfTradePrevention = view.getUint8(pos); - pos += 1; - - const preventSor = view.getUint8(pos); - pos += 1; - - const updateTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const accountType = view.getUint8(pos); - pos += 1; - - const tradeGroupId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const uid = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + AccountResponseDecoder.BLOCK_LENGTH; - - const balances = this.decodeBalancesGroup(view, pos); - pos = balances.nextOffset; - - const permissions = this.decodePermissionsGroup(view, pos); - pos = permissions.nextOffset; - - const reduceOnlyAssets = this.decodeReduceOnlyAssetsGroup(view, pos); - pos = reduceOnlyAssets.nextOffset; - - return { - commissionExponent: commissionExponent, - commissionRateMaker: commissionRateMaker, - commissionRateTaker: commissionRateTaker, - commissionRateBuyer: commissionRateBuyer, - commissionRateSeller: commissionRateSeller, - canTrade: canTrade, - canWithdraw: canWithdraw, - canDeposit: canDeposit, - brokered: brokered, - requireSelfTradePrevention: requireSelfTradePrevention, - preventSor: preventSor, - updateTime: updateTime, - accountType: accountType, - tradeGroupId: tradeGroupId, - uid: uid, - balances: balances.items, - permissions: permissions.items, - reduceOnlyAssets: reduceOnlyAssets.items - }; - } - private decodeBalancesGroup(view: DataView, offset: number): { items: Balances[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Balances[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const exponent = view.getInt8(pos); - pos += 1; - - const free = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const locked = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const assetLen = view.getUint8(pos); - pos += 1; - const asset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, assetLen)); - pos += assetLen; - - items.push({ - exponent: exponent, - free: free, - locked: locked, - asset: asset - }); - } - - return { items, nextOffset: pos }; - } - private decodePermissionsGroup(view: DataView, offset: number): { items: Permissions[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Permissions[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const permissionLen = view.getUint8(pos); - pos += 1; - const permission = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, permissionLen)); - pos += permissionLen; - - items.push({ - permission: permission - }); - } - - return { items, nextOffset: pos }; - } - private decodeReduceOnlyAssetsGroup(view: DataView, offset: number): { items: ReduceOnlyAssets[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: ReduceOnlyAssets[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const assetLen = view.getUint8(pos); - pos += 1; - const asset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, assetLen)); - pos += assetLen; - - items.push({ - asset: asset - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return AccountResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return AccountResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return AccountResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return AccountResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/AccountTradesResponse.ts b/binance/generated-typescript/spot_sbe/AccountTradesResponse.ts deleted file mode 100644 index 1b7770d785..0000000000 --- a/binance/generated-typescript/spot_sbe/AccountTradesResponse.ts +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Trades { - priceExponent: number; - qtyExponent: number; - commissionExponent: number; - id: bigint; - orderId: bigint; - orderListId: bigint; - price: bigint; - qty: bigint; - quoteQty: bigint; - commission: bigint; - time: bigint; - isBuyer: number; - isMaker: number; - isBestMatch: number; - symbol: string; - commissionAsset: string; -} - -export interface AccountTradesResponse { - trades: Trades[]; -} - -export class AccountTradesResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 401; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): AccountTradesResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + AccountTradesResponseDecoder.BLOCK_LENGTH; - - const trades = this.decodeTradesGroup(view, pos); - pos = trades.nextOffset; - - return { - trades: trades.items - }; - } - private decodeTradesGroup(view: DataView, offset: number): { items: Trades[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Trades[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const commissionExponent = view.getInt8(pos); - pos += 1; - - const id = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const quoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const commission = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const time = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const isBuyer = view.getUint8(pos); - pos += 1; - - const isMaker = view.getUint8(pos); - pos += 1; - - const isBestMatch = view.getUint8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const commissionAssetLen = view.getUint8(pos); - pos += 1; - const commissionAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, commissionAssetLen)); - pos += commissionAssetLen; - - items.push({ - priceExponent: priceExponent, - qtyExponent: qtyExponent, - commissionExponent: commissionExponent, - id: id, - orderId: orderId, - orderListId: orderListId, - price: price, - qty: qty, - quoteQty: quoteQty, - commission: commission, - time: time, - isBuyer: isBuyer, - isMaker: isMaker, - isBestMatch: isBestMatch, - symbol: symbol, - commissionAsset: commissionAsset - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return AccountTradesResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return AccountTradesResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return AccountTradesResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return AccountTradesResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/AccountType.ts b/binance/generated-typescript/spot_sbe/AccountType.ts deleted file mode 100644 index ac4b3827e3..0000000000 --- a/binance/generated-typescript/spot_sbe/AccountType.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum AccountType { - Spot = 0, - Unknown = 2, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/AggTradesResponse.ts b/binance/generated-typescript/spot_sbe/AggTradesResponse.ts deleted file mode 100644 index 9d8723f9bc..0000000000 --- a/binance/generated-typescript/spot_sbe/AggTradesResponse.ts +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface AggTrades { - aggTradeId: bigint; - price: bigint; - qty: bigint; - firstTradeId: bigint; - lastTradeId: bigint; - time: bigint; - isBuyerMaker: number; - isBestMatch: number; -} - -export interface AggTradesResponse { - priceExponent: number; - qtyExponent: number; - aggTrades: AggTrades[]; -} - -export class AggTradesResponseDecoder { - private static readonly BLOCK_LENGTH = 2; - private static readonly TEMPLATE_ID = 202; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): AggTradesResponse { - const view = new DataView(buffer); - let pos = offset; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = offset + AggTradesResponseDecoder.BLOCK_LENGTH; - - const aggTrades = this.decodeAggTradesGroup(view, pos); - pos = aggTrades.nextOffset; - - return { - priceExponent: priceExponent, - qtyExponent: qtyExponent, - aggTrades: aggTrades.items - }; - } - private decodeAggTradesGroup(view: DataView, offset: number): { items: AggTrades[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: AggTrades[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const aggTradeId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const firstTradeId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastTradeId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const time = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const isBuyerMaker = view.getUint8(pos); - pos += 1; - - const isBestMatch = view.getUint8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - items.push({ - aggTradeId: aggTradeId, - price: price, - qty: qty, - firstTradeId: firstTradeId, - lastTradeId: lastTradeId, - time: time, - isBuyerMaker: isBuyerMaker, - isBestMatch: isBestMatch - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return AggTradesResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return AggTradesResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return AggTradesResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return AggTradesResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/AllocationType.ts b/binance/generated-typescript/spot_sbe/AllocationType.ts deleted file mode 100644 index f88434eb36..0000000000 --- a/binance/generated-typescript/spot_sbe/AllocationType.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum AllocationType { - Unknown = 0, - Sor = 2, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/AllowedSelfTradePreventionModes.ts b/binance/generated-typescript/spot_sbe/AllowedSelfTradePreventionModes.ts deleted file mode 100644 index cd5fa916cb..0000000000 --- a/binance/generated-typescript/spot_sbe/AllowedSelfTradePreventionModes.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface AllowedSelfTradePreventionModes { - none: boolean; - expireTaker: boolean; - expireMaker: boolean; - expireBoth: boolean; - decrement: boolean; - transfer: boolean; - nonRepresentable: boolean; -} - -export class AllowedSelfTradePreventionModesDecoder { - static decode(view: DataView, offset: number, littleEndian: boolean): AllowedSelfTradePreventionModes { - const bits = view.getUint8(offset); - - return { - none: (bits & (1 << 0)) !== 0, - expireTaker: (bits & (1 << 1)) !== 0, - expireMaker: (bits & (1 << 2)) !== 0, - expireBoth: (bits & (1 << 3)) !== 0, - decrement: (bits & (1 << 4)) !== 0, - transfer: (bits & (1 << 5)) !== 0, - nonRepresentable: (bits & (1 << 7)) !== 0 - }; - } - - static getEncodedLength(): number { - return 1; - } -} diff --git a/binance/generated-typescript/spot_sbe/AveragePriceResponse.ts b/binance/generated-typescript/spot_sbe/AveragePriceResponse.ts deleted file mode 100644 index 1a8eb63934..0000000000 --- a/binance/generated-typescript/spot_sbe/AveragePriceResponse.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface AveragePriceResponse { - mins: bigint; - priceExponent: number; - price: bigint; - closeTime: bigint; -} - -export class AveragePriceResponseDecoder { - private static readonly BLOCK_LENGTH = 25; - private static readonly TEMPLATE_ID = 204; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): AveragePriceResponse { - const view = new DataView(buffer); - let pos = offset; - - const mins = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const closeTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + AveragePriceResponseDecoder.BLOCK_LENGTH; - - return { - mins: mins, - priceExponent: priceExponent, - price: price, - closeTime: closeTime - }; - } - - static getBlockLength(): number { - return AveragePriceResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return AveragePriceResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return AveragePriceResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return AveragePriceResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/BalanceUpdateEvent.ts b/binance/generated-typescript/spot_sbe/BalanceUpdateEvent.ts deleted file mode 100644 index 0ec8bad6c1..0000000000 --- a/binance/generated-typescript/spot_sbe/BalanceUpdateEvent.ts +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface BalanceUpdateEvent { - eventTime: bigint; - clearTime: bigint; - qtyExponent: number; - freeQtyDelta: bigint; - subscriptionId: number; - asset: string; -} - -export class BalanceUpdateEventDecoder { - private static readonly BLOCK_LENGTH = 27; - private static readonly TEMPLATE_ID = 601; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): BalanceUpdateEvent { - const view = new DataView(buffer); - let pos = offset; - - const eventTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const clearTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const freeQtyDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const subscriptionId = view.getUint16(pos, this.littleEndian); - pos += 2; - - // Skip to end of block for forward compatibility - pos = offset + BalanceUpdateEventDecoder.BLOCK_LENGTH; - - const assetLen = view.getUint8(pos); - pos += 1; - const asset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, assetLen)); - pos += assetLen; - - return { - eventTime: eventTime, - clearTime: clearTime, - qtyExponent: qtyExponent, - freeQtyDelta: freeQtyDelta, - subscriptionId: subscriptionId, - asset: asset - }; - } - - static getBlockLength(): number { - return BalanceUpdateEventDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return BalanceUpdateEventDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return BalanceUpdateEventDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return BalanceUpdateEventDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/BookTickerResponse.ts b/binance/generated-typescript/spot_sbe/BookTickerResponse.ts deleted file mode 100644 index 00d56aaaf8..0000000000 --- a/binance/generated-typescript/spot_sbe/BookTickerResponse.ts +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Tickers { - priceExponent: number; - qtyExponent: number; - bidPrice: bigint; - bidQty: bigint; - askPrice: bigint; - askQty: bigint; - symbol: string; -} - -export interface BookTickerResponse { - tickers: Tickers[]; -} - -export class BookTickerResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 212; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): BookTickerResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + BookTickerResponseDecoder.BLOCK_LENGTH; - - const tickers = this.decodeTickersGroup(view, pos); - pos = tickers.nextOffset; - - return { - tickers: tickers.items - }; - } - private decodeTickersGroup(view: DataView, offset: number): { items: Tickers[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Tickers[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const bidPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const bidQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const askPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const askQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - items.push({ - priceExponent: priceExponent, - qtyExponent: qtyExponent, - bidPrice: bidPrice, - bidQty: bidQty, - askPrice: askPrice, - askQty: askQty, - symbol: symbol - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return BookTickerResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return BookTickerResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return BookTickerResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return BookTickerResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/BookTickerSymbolResponse.ts b/binance/generated-typescript/spot_sbe/BookTickerSymbolResponse.ts deleted file mode 100644 index d5add67bd2..0000000000 --- a/binance/generated-typescript/spot_sbe/BookTickerSymbolResponse.ts +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface BookTickerSymbolResponse { - priceExponent: number; - qtyExponent: number; - bidPrice: bigint; - bidQty: bigint; - askPrice: bigint; - askQty: bigint; - symbol: string; -} - -export class BookTickerSymbolResponseDecoder { - private static readonly BLOCK_LENGTH = 34; - private static readonly TEMPLATE_ID = 211; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): BookTickerSymbolResponse { - const view = new DataView(buffer); - let pos = offset; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const bidPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const bidQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const askPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const askQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + BookTickerSymbolResponseDecoder.BLOCK_LENGTH; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - return { - priceExponent: priceExponent, - qtyExponent: qtyExponent, - bidPrice: bidPrice, - bidQty: bidQty, - askPrice: askPrice, - askQty: askQty, - symbol: symbol - }; - } - - static getBlockLength(): number { - return BookTickerSymbolResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return BookTickerSymbolResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return BookTickerSymbolResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return BookTickerSymbolResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/BoolEnum.ts b/binance/generated-typescript/spot_sbe/BoolEnum.ts deleted file mode 100644 index 2824154952..0000000000 --- a/binance/generated-typescript/spot_sbe/BoolEnum.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum BoolEnum { - False = 0, - True = 1 -} diff --git a/binance/generated-typescript/spot_sbe/CancelOpenOrdersResponse.ts b/binance/generated-typescript/spot_sbe/CancelOpenOrdersResponse.ts deleted file mode 100644 index 46f382817e..0000000000 --- a/binance/generated-typescript/spot_sbe/CancelOpenOrdersResponse.ts +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Responses { - response: Uint8Array; -} - -export interface CancelOpenOrdersResponse { - responses: Responses[]; -} - -export class CancelOpenOrdersResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 306; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): CancelOpenOrdersResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + CancelOpenOrdersResponseDecoder.BLOCK_LENGTH; - - const responses = this.decodeResponsesGroup(view, pos); - pos = responses.nextOffset; - - return { - responses: responses.items - }; - } - private decodeResponsesGroup(view: DataView, offset: number): { items: Responses[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Responses[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const responseLen = view.getUint16(pos, this.littleEndian); - pos += 2; - const response = new Uint8Array(view.buffer, view.byteOffset + pos, responseLen); - pos += responseLen; - - items.push({ - response: response - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return CancelOpenOrdersResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return CancelOpenOrdersResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return CancelOpenOrdersResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return CancelOpenOrdersResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/CancelOrderListResponse.ts b/binance/generated-typescript/spot_sbe/CancelOrderListResponse.ts deleted file mode 100644 index 4df04b8acc..0000000000 --- a/binance/generated-typescript/spot_sbe/CancelOrderListResponse.ts +++ /dev/null @@ -1,332 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Orders { - orderId: bigint; - symbol: string; - clientOrderId: string; -} - -export interface OrderReports { - orderId: bigint; - orderListId: bigint; - transactTime: bigint; - price: bigint; - origQty: bigint; - executedQty: bigint; - cummulativeQuoteQty: bigint; - status: number; - timeInForce: number; - orderType: number; - side: number; - stopPrice: bigint; - trailingDelta: bigint; - trailingTime: bigint; - icebergQty: bigint; - strategyId: bigint; - strategyType: number; - orderCapacity: number; - workingFloor: number; - selfTradePreventionMode: number; - preventedQuantity: bigint; - usedSor: number; - origQuoteOrderQty: bigint; - pegPriceType: number; - pegOffsetType: number; - pegOffsetValue: number; - peggedPrice: bigint; - symbol: string; - origClientOrderId: string; - clientOrderId: string; -} - -export interface CancelOrderListResponse { - orderListId: bigint; - contingencyType: number; - listStatusType: number; - listOrderStatus: number; - transactionTime: bigint; - priceExponent: number; - qtyExponent: number; - orders: Orders[]; - orderReports: OrderReports[]; - listClientOrderId: string; - symbol: string; -} - -export class CancelOrderListResponseDecoder { - private static readonly BLOCK_LENGTH = 21; - private static readonly TEMPLATE_ID = 312; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): CancelOrderListResponse { - const view = new DataView(buffer); - let pos = offset; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const contingencyType = view.getUint8(pos); - pos += 1; - - const listStatusType = view.getUint8(pos); - pos += 1; - - const listOrderStatus = view.getUint8(pos); - pos += 1; - - const transactionTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = offset + CancelOrderListResponseDecoder.BLOCK_LENGTH; - - const orders = this.decodeOrdersGroup(view, pos); - pos = orders.nextOffset; - - const orderReports = this.decodeOrderReportsGroup(view, pos); - pos = orderReports.nextOffset; - - const listClientOrderIdLen = view.getUint8(pos); - pos += 1; - const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); - pos += listClientOrderIdLen; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - return { - orderListId: orderListId, - contingencyType: contingencyType, - listStatusType: listStatusType, - listOrderStatus: listOrderStatus, - transactionTime: transactionTime, - priceExponent: priceExponent, - qtyExponent: qtyExponent, - orders: orders.items, - orderReports: orderReports.items, - listClientOrderId: listClientOrderId, - symbol: symbol - }; - } - private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: Orders[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - orderId: orderId, - symbol: symbol, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - private decodeOrderReportsGroup(view: DataView, offset: number): { items: OrderReports[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: OrderReports[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const transactTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const origQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const status = view.getUint8(pos); - pos += 1; - - const timeInForce = view.getUint8(pos); - pos += 1; - - const orderType = view.getUint8(pos); - pos += 1; - - const side = view.getUint8(pos); - pos += 1; - - const stopPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const icebergQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyType = view.getInt32(pos, this.littleEndian); - pos += 4; - - const orderCapacity = view.getUint8(pos); - pos += 1; - - const workingFloor = view.getUint8(pos); - pos += 1; - - const selfTradePreventionMode = view.getUint8(pos); - pos += 1; - - const preventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const usedSor = view.getUint8(pos); - pos += 1; - - const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const pegPriceType = view.getUint8(pos); - pos += 1; - - const pegOffsetType = view.getUint8(pos); - pos += 1; - - const pegOffsetValue = view.getUint8(pos); - pos += 1; - - const peggedPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const origClientOrderIdLen = view.getUint8(pos); - pos += 1; - const origClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, origClientOrderIdLen)); - pos += origClientOrderIdLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - orderId: orderId, - orderListId: orderListId, - transactTime: transactTime, - price: price, - origQty: origQty, - executedQty: executedQty, - cummulativeQuoteQty: cummulativeQuoteQty, - status: status, - timeInForce: timeInForce, - orderType: orderType, - side: side, - stopPrice: stopPrice, - trailingDelta: trailingDelta, - trailingTime: trailingTime, - icebergQty: icebergQty, - strategyId: strategyId, - strategyType: strategyType, - orderCapacity: orderCapacity, - workingFloor: workingFloor, - selfTradePreventionMode: selfTradePreventionMode, - preventedQuantity: preventedQuantity, - usedSor: usedSor, - origQuoteOrderQty: origQuoteOrderQty, - pegPriceType: pegPriceType, - pegOffsetType: pegOffsetType, - pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice, - symbol: symbol, - origClientOrderId: origClientOrderId, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return CancelOrderListResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return CancelOrderListResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return CancelOrderListResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return CancelOrderListResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/CancelOrderResponse.ts b/binance/generated-typescript/spot_sbe/CancelOrderResponse.ts deleted file mode 100644 index 3f05089833..0000000000 --- a/binance/generated-typescript/spot_sbe/CancelOrderResponse.ts +++ /dev/null @@ -1,214 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface CancelOrderResponse { - priceExponent: number; - qtyExponent: number; - orderId: bigint; - orderListId: bigint; - transactTime: bigint; - price: bigint; - origQty: bigint; - executedQty: bigint; - cummulativeQuoteQty: bigint; - status: number; - timeInForce: number; - orderType: number; - side: number; - stopPrice: bigint; - trailingDelta: bigint; - trailingTime: bigint; - icebergQty: bigint; - strategyId: bigint; - strategyType: number; - orderCapacity: number; - workingFloor: number; - selfTradePreventionMode: number; - preventedQuantity: bigint; - usedSor: number; - origQuoteOrderQty: bigint; - pegPriceType: number; - pegOffsetType: number; - pegOffsetValue: number; - peggedPrice: bigint; - symbol: string; - origClientOrderId: string; - clientOrderId: string; -} - -export class CancelOrderResponseDecoder { - private static readonly BLOCK_LENGTH = 137; - private static readonly TEMPLATE_ID = 305; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): CancelOrderResponse { - const view = new DataView(buffer); - let pos = offset; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const transactTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const origQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const status = view.getUint8(pos); - pos += 1; - - const timeInForce = view.getUint8(pos); - pos += 1; - - const orderType = view.getUint8(pos); - pos += 1; - - const side = view.getUint8(pos); - pos += 1; - - const stopPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const icebergQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyType = view.getInt32(pos, this.littleEndian); - pos += 4; - - const orderCapacity = view.getUint8(pos); - pos += 1; - - const workingFloor = view.getUint8(pos); - pos += 1; - - const selfTradePreventionMode = view.getUint8(pos); - pos += 1; - - const preventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const usedSor = view.getUint8(pos); - pos += 1; - - const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const pegPriceType = view.getUint8(pos); - pos += 1; - - const pegOffsetType = view.getUint8(pos); - pos += 1; - - const pegOffsetValue = view.getUint8(pos); - pos += 1; - - const peggedPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + CancelOrderResponseDecoder.BLOCK_LENGTH; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const origClientOrderIdLen = view.getUint8(pos); - pos += 1; - const origClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, origClientOrderIdLen)); - pos += origClientOrderIdLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - return { - priceExponent: priceExponent, - qtyExponent: qtyExponent, - orderId: orderId, - orderListId: orderListId, - transactTime: transactTime, - price: price, - origQty: origQty, - executedQty: executedQty, - cummulativeQuoteQty: cummulativeQuoteQty, - status: status, - timeInForce: timeInForce, - orderType: orderType, - side: side, - stopPrice: stopPrice, - trailingDelta: trailingDelta, - trailingTime: trailingTime, - icebergQty: icebergQty, - strategyId: strategyId, - strategyType: strategyType, - orderCapacity: orderCapacity, - workingFloor: workingFloor, - selfTradePreventionMode: selfTradePreventionMode, - preventedQuantity: preventedQuantity, - usedSor: usedSor, - origQuoteOrderQty: origQuoteOrderQty, - pegPriceType: pegPriceType, - pegOffsetType: pegOffsetType, - pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice, - symbol: symbol, - origClientOrderId: origClientOrderId, - clientOrderId: clientOrderId - }; - } - - static getBlockLength(): number { - return CancelOrderResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return CancelOrderResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return CancelOrderResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return CancelOrderResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/CancelReplaceOrderResponse.ts b/binance/generated-typescript/spot_sbe/CancelReplaceOrderResponse.ts deleted file mode 100644 index e90890b8d0..0000000000 --- a/binance/generated-typescript/spot_sbe/CancelReplaceOrderResponse.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface CancelReplaceOrderResponse { - cancelResult: number; - newOrderResult: number; - cancelResponse: Uint8Array; - newOrderResponse: Uint8Array; -} - -export class CancelReplaceOrderResponseDecoder { - private static readonly BLOCK_LENGTH = 2; - private static readonly TEMPLATE_ID = 307; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): CancelReplaceOrderResponse { - const view = new DataView(buffer); - let pos = offset; - - const cancelResult = view.getUint8(pos); - pos += 1; - - const newOrderResult = view.getUint8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = offset + CancelReplaceOrderResponseDecoder.BLOCK_LENGTH; - - const cancelResponseLen = view.getUint16(pos, this.littleEndian); - pos += 2; - const cancelResponse = new Uint8Array(view.buffer, view.byteOffset + pos, cancelResponseLen); - pos += cancelResponseLen; - - const newOrderResponseLen = view.getUint32(pos, this.littleEndian); - pos += 4; - const newOrderResponse = new Uint8Array(view.buffer, view.byteOffset + pos, newOrderResponseLen); - pos += newOrderResponseLen; - - return { - cancelResult: cancelResult, - newOrderResult: newOrderResult, - cancelResponse: cancelResponse, - newOrderResponse: newOrderResponse - }; - } - - static getBlockLength(): number { - return CancelReplaceOrderResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return CancelReplaceOrderResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return CancelReplaceOrderResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return CancelReplaceOrderResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/CancelReplaceStatus.ts b/binance/generated-typescript/spot_sbe/CancelReplaceStatus.ts deleted file mode 100644 index 5f7f82f55b..0000000000 --- a/binance/generated-typescript/spot_sbe/CancelReplaceStatus.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum CancelReplaceStatus { - Success = 0, - Failure = 1, - NotAttempted = 2, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/ContingencyType.ts b/binance/generated-typescript/spot_sbe/ContingencyType.ts deleted file mode 100644 index 297070be7a..0000000000 --- a/binance/generated-typescript/spot_sbe/ContingencyType.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum ContingencyType { - Oco = 1, - Oto = 2, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/DepthResponse.ts b/binance/generated-typescript/spot_sbe/DepthResponse.ts deleted file mode 100644 index eee339a442..0000000000 --- a/binance/generated-typescript/spot_sbe/DepthResponse.ts +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Bids { - price: bigint; - qty: bigint; -} - -export interface Asks { - price: bigint; - qty: bigint; -} - -export interface DepthResponse { - lastUpdateId: bigint; - priceExponent: number; - qtyExponent: number; - bids: Bids[]; - asks: Asks[]; -} - -export class DepthResponseDecoder { - private static readonly BLOCK_LENGTH = 10; - private static readonly TEMPLATE_ID = 200; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): DepthResponse { - const view = new DataView(buffer); - let pos = offset; - - const lastUpdateId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = offset + DepthResponseDecoder.BLOCK_LENGTH; - - const bids = this.decodeBidsGroup(view, pos); - pos = bids.nextOffset; - - const asks = this.decodeAsksGroup(view, pos); - pos = asks.nextOffset; - - return { - lastUpdateId: lastUpdateId, - priceExponent: priceExponent, - qtyExponent: qtyExponent, - bids: bids.items, - asks: asks.items - }; - } - private decodeBidsGroup(view: DataView, offset: number): { items: Bids[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Bids[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - items.push({ - price: price, - qty: qty - }); - } - - return { items, nextOffset: pos }; - } - private decodeAsksGroup(view: DataView, offset: number): { items: Asks[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Asks[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - items.push({ - price: price, - qty: qty - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return DepthResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return DepthResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return DepthResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return DepthResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/ErrorResponse.ts b/binance/generated-typescript/spot_sbe/ErrorResponse.ts deleted file mode 100644 index cbfbf59c8e..0000000000 --- a/binance/generated-typescript/spot_sbe/ErrorResponse.ts +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface ErrorResponse { - code: number; - serverTime: bigint; - retryAfter: bigint; - msg: string; - data: Uint8Array; -} - -export class ErrorResponseDecoder { - private static readonly BLOCK_LENGTH = 18; - private static readonly TEMPLATE_ID = 100; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): ErrorResponse { - const view = new DataView(buffer); - let pos = offset; - - const code = view.getInt16(pos, this.littleEndian); - pos += 2; - - const serverTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const retryAfter = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + ErrorResponseDecoder.BLOCK_LENGTH; - - const msgLen = view.getUint16(pos, this.littleEndian); - pos += 2; - const msg = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, msgLen)); - pos += msgLen; - - const dataLen = view.getUint32(pos, this.littleEndian); - pos += 4; - const data = new Uint8Array(view.buffer, view.byteOffset + pos, dataLen); - pos += dataLen; - - return { - code: code, - serverTime: serverTime, - retryAfter: retryAfter, - msg: msg, - data: data - }; - } - - static getBlockLength(): number { - return ErrorResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return ErrorResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return ErrorResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return ErrorResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/EventStreamTerminatedEvent.ts b/binance/generated-typescript/spot_sbe/EventStreamTerminatedEvent.ts deleted file mode 100644 index 0dd8be5a68..0000000000 --- a/binance/generated-typescript/spot_sbe/EventStreamTerminatedEvent.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface EventStreamTerminatedEvent { - eventTime: bigint; - subscriptionId: number; -} - -export class EventStreamTerminatedEventDecoder { - private static readonly BLOCK_LENGTH = 10; - private static readonly TEMPLATE_ID = 602; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): EventStreamTerminatedEvent { - const view = new DataView(buffer); - let pos = offset; - - const eventTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const subscriptionId = view.getUint16(pos, this.littleEndian); - pos += 2; - - // Skip to end of block for forward compatibility - pos = offset + EventStreamTerminatedEventDecoder.BLOCK_LENGTH; - - return { - eventTime: eventTime, - subscriptionId: subscriptionId - }; - } - - static getBlockLength(): number { - return EventStreamTerminatedEventDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return EventStreamTerminatedEventDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return EventStreamTerminatedEventDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return EventStreamTerminatedEventDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/ExchangeInfoResponse.ts b/binance/generated-typescript/spot_sbe/ExchangeInfoResponse.ts deleted file mode 100644 index ddbdbd035a..0000000000 --- a/binance/generated-typescript/spot_sbe/ExchangeInfoResponse.ts +++ /dev/null @@ -1,454 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface RateLimits { - rateLimitType: number; - interval: number; - intervalNum: number; - rateLimit: bigint; -} - -export interface ExchangeFilters { - filter: Uint8Array; -} - -export interface Filters { - filter: Uint8Array; -} - -export interface Permissions { - permission: string; -} - -export interface PermissionSets { - permissions: Permissions[]; -} - -export interface Symbols { - status: number; - baseAssetPrecision: number; - quoteAssetPrecision: number; - baseCommissionPrecision: number; - quoteCommissionPrecision: number; - orderTypes: number; - icebergAllowed: number; - ocoAllowed: number; - otoAllowed: number; - quoteOrderQtyMarketAllowed: number; - allowTrailingStop: number; - cancelReplaceAllowed: number; - amendAllowed: number; - isSpotTradingAllowed: number; - isMarginTradingAllowed: number; - defaultSelfTradePreventionMode: number; - allowedSelfTradePreventionModes: number; - pegInstructionsAllowed: number; - filters: Filters[]; - permissionSets: PermissionSets[]; - symbol: string; - baseAsset: string; - quoteAsset: string; -} - -export interface SorSymbols { - symbol: string; -} - -export interface Sors { - sorSymbols: SorSymbols[]; - baseAsset: string; -} - -export interface ExchangeInfoResponse { - rateLimits: RateLimits[]; - exchangeFilters: ExchangeFilters[]; - symbols: Symbols[]; - sors: Sors[]; -} - -export class ExchangeInfoResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 103; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): ExchangeInfoResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + ExchangeInfoResponseDecoder.BLOCK_LENGTH; - - const rateLimits = this.decodeRateLimitsGroup(view, pos); - pos = rateLimits.nextOffset; - - const exchangeFilters = this.decodeExchangeFiltersGroup(view, pos); - pos = exchangeFilters.nextOffset; - - const symbols = this.decodeSymbolsGroup(view, pos); - pos = symbols.nextOffset; - - const sors = this.decodeSorsGroup(view, pos); - pos = sors.nextOffset; - - return { - rateLimits: rateLimits.items, - exchangeFilters: exchangeFilters.items, - symbols: symbols.items, - sors: sors.items - }; - } - private decodeRateLimitsGroup(view: DataView, offset: number): { items: RateLimits[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: RateLimits[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const rateLimitType = view.getUint8(pos); - pos += 1; - - const interval = view.getUint8(pos); - pos += 1; - - const intervalNum = view.getUint8(pos); - pos += 1; - - const rateLimit = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - items.push({ - rateLimitType: rateLimitType, - interval: interval, - intervalNum: intervalNum, - rateLimit: rateLimit - }); - } - - return { items, nextOffset: pos }; - } - private decodeExchangeFiltersGroup(view: DataView, offset: number): { items: ExchangeFilters[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: ExchangeFilters[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const filterLen = view.getUint8(pos); - pos += 1; - const filter = new Uint8Array(view.buffer, view.byteOffset + pos, filterLen); - pos += filterLen; - - items.push({ - filter: filter - }); - } - - return { items, nextOffset: pos }; - } - private decodeSymbolsGroup(view: DataView, offset: number): { items: Symbols[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Symbols[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const status = view.getUint8(pos); - pos += 1; - - const baseAssetPrecision = view.getUint8(pos); - pos += 1; - - const quoteAssetPrecision = view.getUint8(pos); - pos += 1; - - const baseCommissionPrecision = view.getUint8(pos); - pos += 1; - - const quoteCommissionPrecision = view.getUint8(pos); - pos += 1; - - const orderTypes = view.getUint16(pos, this.littleEndian); - pos += 2; - - const icebergAllowed = view.getUint8(pos); - pos += 1; - - const ocoAllowed = view.getUint8(pos); - pos += 1; - - const otoAllowed = view.getUint8(pos); - pos += 1; - - const quoteOrderQtyMarketAllowed = view.getUint8(pos); - pos += 1; - - const allowTrailingStop = view.getUint8(pos); - pos += 1; - - const cancelReplaceAllowed = view.getUint8(pos); - pos += 1; - - const amendAllowed = view.getUint8(pos); - pos += 1; - - const isSpotTradingAllowed = view.getUint8(pos); - pos += 1; - - const isMarginTradingAllowed = view.getUint8(pos); - pos += 1; - - const defaultSelfTradePreventionMode = view.getUint8(pos); - pos += 1; - - const allowedSelfTradePreventionModes = view.getUint8(pos); - pos += 1; - - const pegInstructionsAllowed = view.getUint8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const filters = this.decodeFiltersGroup(view, pos); - pos = filters.nextOffset; - - const permissionSets = this.decodePermissionSetsGroup(view, pos); - pos = permissionSets.nextOffset; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const baseAssetLen = view.getUint8(pos); - pos += 1; - const baseAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, baseAssetLen)); - pos += baseAssetLen; - - const quoteAssetLen = view.getUint8(pos); - pos += 1; - const quoteAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, quoteAssetLen)); - pos += quoteAssetLen; - - items.push({ - status: status, - baseAssetPrecision: baseAssetPrecision, - quoteAssetPrecision: quoteAssetPrecision, - baseCommissionPrecision: baseCommissionPrecision, - quoteCommissionPrecision: quoteCommissionPrecision, - orderTypes: orderTypes, - icebergAllowed: icebergAllowed, - ocoAllowed: ocoAllowed, - otoAllowed: otoAllowed, - quoteOrderQtyMarketAllowed: quoteOrderQtyMarketAllowed, - allowTrailingStop: allowTrailingStop, - cancelReplaceAllowed: cancelReplaceAllowed, - amendAllowed: amendAllowed, - isSpotTradingAllowed: isSpotTradingAllowed, - isMarginTradingAllowed: isMarginTradingAllowed, - defaultSelfTradePreventionMode: defaultSelfTradePreventionMode, - allowedSelfTradePreventionModes: allowedSelfTradePreventionModes, - pegInstructionsAllowed: pegInstructionsAllowed, - filters: filters.items, - permissionSets: permissionSets.items, - symbol: symbol, - baseAsset: baseAsset, - quoteAsset: quoteAsset - }); - } - - return { items, nextOffset: pos }; - } - private decodeFiltersGroup(view: DataView, offset: number): { items: Filters[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Filters[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const filterLen = view.getUint8(pos); - pos += 1; - const filter = new Uint8Array(view.buffer, view.byteOffset + pos, filterLen); - pos += filterLen; - - items.push({ - filter: filter - }); - } - - return { items, nextOffset: pos }; - } - private decodePermissionSetsGroup(view: DataView, offset: number): { items: PermissionSets[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: PermissionSets[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const permissions = this.decodePermissionsGroup(view, pos); - pos = permissions.nextOffset; - - items.push({ - permissions: permissions.items - }); - } - - return { items, nextOffset: pos }; - } - private decodePermissionsGroup(view: DataView, offset: number): { items: Permissions[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Permissions[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const permissionLen = view.getUint8(pos); - pos += 1; - const permission = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, permissionLen)); - pos += permissionLen; - - items.push({ - permission: permission - }); - } - - return { items, nextOffset: pos }; - } - private decodeSorsGroup(view: DataView, offset: number): { items: Sors[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Sors[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const sorSymbols = this.decodeSorSymbolsGroup(view, pos); - pos = sorSymbols.nextOffset; - - const baseAssetLen = view.getUint8(pos); - pos += 1; - const baseAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, baseAssetLen)); - pos += baseAssetLen; - - items.push({ - sorSymbols: sorSymbols.items, - baseAsset: baseAsset - }); - } - - return { items, nextOffset: pos }; - } - private decodeSorSymbolsGroup(view: DataView, offset: number): { items: SorSymbols[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: SorSymbols[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - items.push({ - symbol: symbol - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return ExchangeInfoResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return ExchangeInfoResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return ExchangeInfoResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return ExchangeInfoResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/ExchangeMaxNumAlgoOrdersFilter.ts b/binance/generated-typescript/spot_sbe/ExchangeMaxNumAlgoOrdersFilter.ts deleted file mode 100644 index 51da8b74f6..0000000000 --- a/binance/generated-typescript/spot_sbe/ExchangeMaxNumAlgoOrdersFilter.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface ExchangeMaxNumAlgoOrdersFilter { - filterType: number; - maxNumAlgoOrders: bigint; -} - -export class ExchangeMaxNumAlgoOrdersFilterDecoder { - private static readonly BLOCK_LENGTH = 8; - private static readonly TEMPLATE_ID = 16; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): ExchangeMaxNumAlgoOrdersFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const maxNumAlgoOrders = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + ExchangeMaxNumAlgoOrdersFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - maxNumAlgoOrders: maxNumAlgoOrders - }; - } - - static getBlockLength(): number { - return ExchangeMaxNumAlgoOrdersFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return ExchangeMaxNumAlgoOrdersFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return ExchangeMaxNumAlgoOrdersFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return ExchangeMaxNumAlgoOrdersFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/ExchangeMaxNumIcebergOrdersFilter.ts b/binance/generated-typescript/spot_sbe/ExchangeMaxNumIcebergOrdersFilter.ts deleted file mode 100644 index 7c18416b81..0000000000 --- a/binance/generated-typescript/spot_sbe/ExchangeMaxNumIcebergOrdersFilter.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface ExchangeMaxNumIcebergOrdersFilter { - filterType: number; - maxNumIcebergOrders: bigint; -} - -export class ExchangeMaxNumIcebergOrdersFilterDecoder { - private static readonly BLOCK_LENGTH = 8; - private static readonly TEMPLATE_ID = 17; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): ExchangeMaxNumIcebergOrdersFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const maxNumIcebergOrders = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + ExchangeMaxNumIcebergOrdersFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - maxNumIcebergOrders: maxNumIcebergOrders - }; - } - - static getBlockLength(): number { - return ExchangeMaxNumIcebergOrdersFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return ExchangeMaxNumIcebergOrdersFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return ExchangeMaxNumIcebergOrdersFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return ExchangeMaxNumIcebergOrdersFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/ExchangeMaxNumOrderListsFilter.ts b/binance/generated-typescript/spot_sbe/ExchangeMaxNumOrderListsFilter.ts deleted file mode 100644 index b965f6831b..0000000000 --- a/binance/generated-typescript/spot_sbe/ExchangeMaxNumOrderListsFilter.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface ExchangeMaxNumOrderListsFilter { - filterType: number; - maxNumOrderLists: bigint; -} - -export class ExchangeMaxNumOrderListsFilterDecoder { - private static readonly BLOCK_LENGTH = 8; - private static readonly TEMPLATE_ID = 19; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): ExchangeMaxNumOrderListsFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const maxNumOrderLists = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + ExchangeMaxNumOrderListsFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - maxNumOrderLists: maxNumOrderLists - }; - } - - static getBlockLength(): number { - return ExchangeMaxNumOrderListsFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return ExchangeMaxNumOrderListsFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return ExchangeMaxNumOrderListsFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return ExchangeMaxNumOrderListsFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/ExchangeMaxNumOrdersFilter.ts b/binance/generated-typescript/spot_sbe/ExchangeMaxNumOrdersFilter.ts deleted file mode 100644 index a4412220e9..0000000000 --- a/binance/generated-typescript/spot_sbe/ExchangeMaxNumOrdersFilter.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface ExchangeMaxNumOrdersFilter { - filterType: number; - maxNumOrders: bigint; -} - -export class ExchangeMaxNumOrdersFilterDecoder { - private static readonly BLOCK_LENGTH = 8; - private static readonly TEMPLATE_ID = 15; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): ExchangeMaxNumOrdersFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const maxNumOrders = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + ExchangeMaxNumOrdersFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - maxNumOrders: maxNumOrders - }; - } - - static getBlockLength(): number { - return ExchangeMaxNumOrdersFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return ExchangeMaxNumOrdersFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return ExchangeMaxNumOrdersFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return ExchangeMaxNumOrdersFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/ExecutionReportEvent.ts b/binance/generated-typescript/spot_sbe/ExecutionReportEvent.ts deleted file mode 100644 index 6dc0b31119..0000000000 --- a/binance/generated-typescript/spot_sbe/ExecutionReportEvent.ts +++ /dev/null @@ -1,355 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface ExecutionReportEvent { - eventTime: bigint; - transactTime: bigint; - priceExponent: number; - qtyExponent: number; - commissionExponent: number; - orderCreationTime: bigint; - workingTime: bigint; - orderId: bigint; - orderListId: bigint; - origQty: bigint; - price: bigint; - origQuoteOrderQty: bigint; - icebergQty: bigint; - stopPrice: bigint; - orderType: number; - side: number; - timeInForce: number; - executionType: number; - orderStatus: number; - tradeId: bigint; - executionId: bigint; - executedQty: bigint; - cummulativeQuoteQty: bigint; - lastQty: bigint; - lastPrice: bigint; - quoteQty: bigint; - commission: bigint; - isWorking: number; - isMaker: number; - isBestMatch: number; - matchType: number; - selfTradePreventionMode: number; - orderCapacity: number; - workingFloor: number; - usedSor: number; - allocId: bigint; - trailingDelta: bigint; - trailingTime: bigint; - tradeGroupId: bigint; - preventedQty: bigint; - lastPreventedQty: bigint; - preventedMatchId: bigint; - preventedExecutionQty: bigint; - preventedExecutionPrice: bigint; - preventedExecutionQuoteQty: bigint; - strategyType: number; - strategyId: bigint; - counterOrderId: bigint; - subscriptionId: number; - pegPriceType: number; - pegOffsetType: number; - pegOffsetValue: number; - peggedPrice: bigint; - symbol: string; - clientOrderId: string; - origClientOrderId: string; - commissionAsset: string; - rejectReason: string; - counterSymbol: string; -} - -export class ExecutionReportEventDecoder { - private static readonly BLOCK_LENGTH = 281; - private static readonly TEMPLATE_ID = 603; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): ExecutionReportEvent { - const view = new DataView(buffer); - let pos = offset; - - const eventTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const transactTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const commissionExponent = view.getInt8(pos); - pos += 1; - - const orderCreationTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const workingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const origQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const icebergQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const stopPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderType = view.getUint8(pos); - pos += 1; - - const side = view.getUint8(pos); - pos += 1; - - const timeInForce = view.getUint8(pos); - pos += 1; - - const executionType = view.getUint8(pos); - pos += 1; - - const orderStatus = view.getUint8(pos); - pos += 1; - - const tradeId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executionId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const quoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const commission = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const isWorking = view.getUint8(pos); - pos += 1; - - const isMaker = view.getUint8(pos); - pos += 1; - - const isBestMatch = view.getUint8(pos); - pos += 1; - - const matchType = view.getUint8(pos); - pos += 1; - - const selfTradePreventionMode = view.getUint8(pos); - pos += 1; - - const orderCapacity = view.getUint8(pos); - pos += 1; - - const workingFloor = view.getUint8(pos); - pos += 1; - - const usedSor = view.getUint8(pos); - pos += 1; - - const allocId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingDelta = view.getBigUint64(pos, this.littleEndian); - pos += 8; - - const trailingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const tradeGroupId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastPreventedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedMatchId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedExecutionQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedExecutionPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedExecutionQuoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyType = view.getInt32(pos, this.littleEndian); - pos += 4; - - const strategyId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const counterOrderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const subscriptionId = view.getUint16(pos, this.littleEndian); - pos += 2; - - const pegPriceType = view.getUint8(pos); - pos += 1; - - const pegOffsetType = view.getUint8(pos); - pos += 1; - - const pegOffsetValue = view.getUint8(pos); - pos += 1; - - const peggedPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + ExecutionReportEventDecoder.BLOCK_LENGTH; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - const origClientOrderIdLen = view.getUint8(pos); - pos += 1; - const origClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, origClientOrderIdLen)); - pos += origClientOrderIdLen; - - const commissionAssetLen = view.getUint8(pos); - pos += 1; - const commissionAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, commissionAssetLen)); - pos += commissionAssetLen; - - const rejectReasonLen = view.getUint8(pos); - pos += 1; - const rejectReason = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, rejectReasonLen)); - pos += rejectReasonLen; - - const counterSymbolLen = view.getUint8(pos); - pos += 1; - const counterSymbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, counterSymbolLen)); - pos += counterSymbolLen; - - return { - eventTime: eventTime, - transactTime: transactTime, - priceExponent: priceExponent, - qtyExponent: qtyExponent, - commissionExponent: commissionExponent, - orderCreationTime: orderCreationTime, - workingTime: workingTime, - orderId: orderId, - orderListId: orderListId, - origQty: origQty, - price: price, - origQuoteOrderQty: origQuoteOrderQty, - icebergQty: icebergQty, - stopPrice: stopPrice, - orderType: orderType, - side: side, - timeInForce: timeInForce, - executionType: executionType, - orderStatus: orderStatus, - tradeId: tradeId, - executionId: executionId, - executedQty: executedQty, - cummulativeQuoteQty: cummulativeQuoteQty, - lastQty: lastQty, - lastPrice: lastPrice, - quoteQty: quoteQty, - commission: commission, - isWorking: isWorking, - isMaker: isMaker, - isBestMatch: isBestMatch, - matchType: matchType, - selfTradePreventionMode: selfTradePreventionMode, - orderCapacity: orderCapacity, - workingFloor: workingFloor, - usedSor: usedSor, - allocId: allocId, - trailingDelta: trailingDelta, - trailingTime: trailingTime, - tradeGroupId: tradeGroupId, - preventedQty: preventedQty, - lastPreventedQty: lastPreventedQty, - preventedMatchId: preventedMatchId, - preventedExecutionQty: preventedExecutionQty, - preventedExecutionPrice: preventedExecutionPrice, - preventedExecutionQuoteQty: preventedExecutionQuoteQty, - strategyType: strategyType, - strategyId: strategyId, - counterOrderId: counterOrderId, - subscriptionId: subscriptionId, - pegPriceType: pegPriceType, - pegOffsetType: pegOffsetType, - pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice, - symbol: symbol, - clientOrderId: clientOrderId, - origClientOrderId: origClientOrderId, - commissionAsset: commissionAsset, - rejectReason: rejectReason, - counterSymbol: counterSymbol - }; - } - - static getBlockLength(): number { - return ExecutionReportEventDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return ExecutionReportEventDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return ExecutionReportEventDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return ExecutionReportEventDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/ExecutionType.ts b/binance/generated-typescript/spot_sbe/ExecutionType.ts deleted file mode 100644 index 4e12788b8d..0000000000 --- a/binance/generated-typescript/spot_sbe/ExecutionType.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum ExecutionType { - New = 0, - Canceled = 1, - Replaced = 2, - Rejected = 3, - Trade = 4, - Expired = 5, - TradePrevention = 8, - Unknown = 253, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/ExternalLockUpdateEvent.ts b/binance/generated-typescript/spot_sbe/ExternalLockUpdateEvent.ts deleted file mode 100644 index db0d754a86..0000000000 --- a/binance/generated-typescript/spot_sbe/ExternalLockUpdateEvent.ts +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface ExternalLockUpdateEvent { - eventTime: bigint; - clearTime: bigint; - qtyExponent: number; - lockedQtyDelta: bigint; - subscriptionId: number; - asset: string; -} - -export class ExternalLockUpdateEventDecoder { - private static readonly BLOCK_LENGTH = 27; - private static readonly TEMPLATE_ID = 604; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): ExternalLockUpdateEvent { - const view = new DataView(buffer); - let pos = offset; - - const eventTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const clearTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const lockedQtyDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const subscriptionId = view.getUint16(pos, this.littleEndian); - pos += 2; - - // Skip to end of block for forward compatibility - pos = offset + ExternalLockUpdateEventDecoder.BLOCK_LENGTH; - - const assetLen = view.getUint8(pos); - pos += 1; - const asset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, assetLen)); - pos += assetLen; - - return { - eventTime: eventTime, - clearTime: clearTime, - qtyExponent: qtyExponent, - lockedQtyDelta: lockedQtyDelta, - subscriptionId: subscriptionId, - asset: asset - }; - } - - static getBlockLength(): number { - return ExternalLockUpdateEventDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return ExternalLockUpdateEventDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return ExternalLockUpdateEventDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return ExternalLockUpdateEventDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/FilterType.ts b/binance/generated-typescript/spot_sbe/FilterType.ts deleted file mode 100644 index 685e90d387..0000000000 --- a/binance/generated-typescript/spot_sbe/FilterType.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum FilterType { - MaxPosition = 0, - PriceFilter = 1, - TPlusSell = 2, - LotSize = 3, - MaxNumOrders = 4, - MinNotional = 5, - MaxNumAlgoOrders = 6, - ExchangeMaxNumOrders = 7, - ExchangeMaxNumAlgoOrders = 8, - IcebergParts = 9, - MarketLotSize = 10, - PercentPrice = 11, - MaxNumIcebergOrders = 12, - ExchangeMaxNumIcebergOrders = 13, - TrailingDelta = 14, - PercentPriceBySide = 15, - Notional = 16, - MaxNumOrderLists = 17, - ExchangeMaxNumOrderLists = 18, - MaxNumOrderAmends = 19, - MaxAsset = 20, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/Floor.ts b/binance/generated-typescript/spot_sbe/Floor.ts deleted file mode 100644 index efeb4280b4..0000000000 --- a/binance/generated-typescript/spot_sbe/Floor.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum Floor { - Exchange = 1, - Broker = 2, - Sor = 3, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/GroupSize16Encoding.ts b/binance/generated-typescript/spot_sbe/GroupSize16Encoding.ts deleted file mode 100644 index bc74bd9478..0000000000 --- a/binance/generated-typescript/spot_sbe/GroupSize16Encoding.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface GroupSize16Encoding { - blockLength: number; - numInGroup: number; -} - -export class GroupSize16EncodingDecoder { - private static readonly ENCODED_LENGTH = 4; - - static decode(view: DataView, offset: number, littleEndian: boolean): GroupSize16Encoding { - let pos = offset; - - const blockLength = view.getUint16(pos, littleEndian); - pos += 2; - - const numInGroup = view.getUint16(pos, littleEndian); - pos += 2; - - return { - blockLength: blockLength, - numInGroup: numInGroup - }; - } - - static getEncodedLength(): number { - return GroupSize16EncodingDecoder.ENCODED_LENGTH; - } -} diff --git a/binance/generated-typescript/spot_sbe/GroupSizeEncoding.ts b/binance/generated-typescript/spot_sbe/GroupSizeEncoding.ts deleted file mode 100644 index bf6bc9016b..0000000000 --- a/binance/generated-typescript/spot_sbe/GroupSizeEncoding.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface GroupSizeEncoding { - blockLength: number; - numInGroup: number; -} - -export class GroupSizeEncodingDecoder { - private static readonly ENCODED_LENGTH = 6; - - static decode(view: DataView, offset: number, littleEndian: boolean): GroupSizeEncoding { - let pos = offset; - - const blockLength = view.getUint16(pos, littleEndian); - pos += 2; - - const numInGroup = view.getUint32(pos, littleEndian); - pos += 4; - - return { - blockLength: blockLength, - numInGroup: numInGroup - }; - } - - static getEncodedLength(): number { - return GroupSizeEncodingDecoder.ENCODED_LENGTH; - } -} diff --git a/binance/generated-typescript/spot_sbe/IcebergPartsFilter.ts b/binance/generated-typescript/spot_sbe/IcebergPartsFilter.ts deleted file mode 100644 index da2c0473c6..0000000000 --- a/binance/generated-typescript/spot_sbe/IcebergPartsFilter.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface IcebergPartsFilter { - filterType: number; - filterLimit: bigint; -} - -export class IcebergPartsFilterDecoder { - private static readonly BLOCK_LENGTH = 8; - private static readonly TEMPLATE_ID = 7; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): IcebergPartsFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const filterLimit = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + IcebergPartsFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - filterLimit: filterLimit - }; - } - - static getBlockLength(): number { - return IcebergPartsFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return IcebergPartsFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return IcebergPartsFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return IcebergPartsFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/KlinesResponse.ts b/binance/generated-typescript/spot_sbe/KlinesResponse.ts deleted file mode 100644 index 8d61e0a622..0000000000 --- a/binance/generated-typescript/spot_sbe/KlinesResponse.ts +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Klines { - openTime: bigint; - openPrice: bigint; - highPrice: bigint; - lowPrice: bigint; - closePrice: bigint; - volume: number; - closeTime: bigint; - quoteVolume: number; - numTrades: bigint; - takerBuyBaseVolume: number; - takerBuyQuoteVolume: number; -} - -export interface KlinesResponse { - priceExponent: number; - qtyExponent: number; - klines: Klines[]; -} - -export class KlinesResponseDecoder { - private static readonly BLOCK_LENGTH = 2; - private static readonly TEMPLATE_ID = 203; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): KlinesResponse { - const view = new DataView(buffer); - let pos = offset; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = offset + KlinesResponseDecoder.BLOCK_LENGTH; - - const klines = this.decodeKlinesGroup(view, pos); - pos = klines.nextOffset; - - return { - priceExponent: priceExponent, - qtyExponent: qtyExponent, - klines: klines.items - }; - } - private decodeKlinesGroup(view: DataView, offset: number): { items: Klines[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Klines[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const openTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const openPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const highPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lowPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const closePrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const volume = view.getUint8(pos); - pos += 16; - - const closeTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const quoteVolume = view.getUint8(pos); - pos += 16; - - const numTrades = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const takerBuyBaseVolume = view.getUint8(pos); - pos += 16; - - const takerBuyQuoteVolume = view.getUint8(pos); - pos += 16; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - items.push({ - openTime: openTime, - openPrice: openPrice, - highPrice: highPrice, - lowPrice: lowPrice, - closePrice: closePrice, - volume: volume, - closeTime: closeTime, - quoteVolume: quoteVolume, - numTrades: numTrades, - takerBuyBaseVolume: takerBuyBaseVolume, - takerBuyQuoteVolume: takerBuyQuoteVolume - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return KlinesResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return KlinesResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return KlinesResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return KlinesResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/ListOrderStatus.ts b/binance/generated-typescript/spot_sbe/ListOrderStatus.ts deleted file mode 100644 index b94e2dffd7..0000000000 --- a/binance/generated-typescript/spot_sbe/ListOrderStatus.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum ListOrderStatus { - Canceling = 0, - Executing = 1, - AllDone = 2, - Reject = 3, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/ListStatusEvent.ts b/binance/generated-typescript/spot_sbe/ListStatusEvent.ts deleted file mode 100644 index 66b200b361..0000000000 --- a/binance/generated-typescript/spot_sbe/ListStatusEvent.ts +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Orders { - orderId: bigint; - symbol: string; - clientOrderId: string; -} - -export interface ListStatusEvent { - eventTime: bigint; - transactTime: bigint; - orderListId: bigint; - contingencyType: number; - listStatusType: number; - listOrderStatus: number; - subscriptionId: number; - orders: Orders[]; - symbol: string; - listClientOrderId: string; - rejectReason: string; -} - -export class ListStatusEventDecoder { - private static readonly BLOCK_LENGTH = 29; - private static readonly TEMPLATE_ID = 606; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): ListStatusEvent { - const view = new DataView(buffer); - let pos = offset; - - const eventTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const transactTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const contingencyType = view.getUint8(pos); - pos += 1; - - const listStatusType = view.getUint8(pos); - pos += 1; - - const listOrderStatus = view.getUint8(pos); - pos += 1; - - const subscriptionId = view.getUint16(pos, this.littleEndian); - pos += 2; - - // Skip to end of block for forward compatibility - pos = offset + ListStatusEventDecoder.BLOCK_LENGTH; - - const orders = this.decodeOrdersGroup(view, pos); - pos = orders.nextOffset; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const listClientOrderIdLen = view.getUint8(pos); - pos += 1; - const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); - pos += listClientOrderIdLen; - - const rejectReasonLen = view.getUint8(pos); - pos += 1; - const rejectReason = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, rejectReasonLen)); - pos += rejectReasonLen; - - return { - eventTime: eventTime, - transactTime: transactTime, - orderListId: orderListId, - contingencyType: contingencyType, - listStatusType: listStatusType, - listOrderStatus: listOrderStatus, - subscriptionId: subscriptionId, - orders: orders.items, - symbol: symbol, - listClientOrderId: listClientOrderId, - rejectReason: rejectReason - }; - } - private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: Orders[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - orderId: orderId, - symbol: symbol, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return ListStatusEventDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return ListStatusEventDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return ListStatusEventDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return ListStatusEventDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/ListStatusType.ts b/binance/generated-typescript/spot_sbe/ListStatusType.ts deleted file mode 100644 index 4ecabc12fe..0000000000 --- a/binance/generated-typescript/spot_sbe/ListStatusType.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum ListStatusType { - Response = 0, - ExecStarted = 1, - AllDone = 2, - Updated = 3, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/LotSizeFilter.ts b/binance/generated-typescript/spot_sbe/LotSizeFilter.ts deleted file mode 100644 index 241386f3fc..0000000000 --- a/binance/generated-typescript/spot_sbe/LotSizeFilter.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface LotSizeFilter { - filterType: number; - qtyExponent: number; - minQty: bigint; - maxQty: bigint; - stepSize: bigint; -} - -export class LotSizeFilterDecoder { - private static readonly BLOCK_LENGTH = 25; - private static readonly TEMPLATE_ID = 4; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): LotSizeFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const minQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const maxQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const stepSize = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + LotSizeFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - qtyExponent: qtyExponent, - minQty: minQty, - maxQty: maxQty, - stepSize: stepSize - }; - } - - static getBlockLength(): number { - return LotSizeFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return LotSizeFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return LotSizeFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return LotSizeFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/MarketLotSizeFilter.ts b/binance/generated-typescript/spot_sbe/MarketLotSizeFilter.ts deleted file mode 100644 index a81a9a3fc5..0000000000 --- a/binance/generated-typescript/spot_sbe/MarketLotSizeFilter.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface MarketLotSizeFilter { - filterType: number; - qtyExponent: number; - minQty: bigint; - maxQty: bigint; - stepSize: bigint; -} - -export class MarketLotSizeFilterDecoder { - private static readonly BLOCK_LENGTH = 25; - private static readonly TEMPLATE_ID = 8; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): MarketLotSizeFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const minQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const maxQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const stepSize = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + MarketLotSizeFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - qtyExponent: qtyExponent, - minQty: minQty, - maxQty: maxQty, - stepSize: stepSize - }; - } - - static getBlockLength(): number { - return MarketLotSizeFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return MarketLotSizeFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return MarketLotSizeFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return MarketLotSizeFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/MatchType.ts b/binance/generated-typescript/spot_sbe/MatchType.ts deleted file mode 100644 index f4c2b3c106..0000000000 --- a/binance/generated-typescript/spot_sbe/MatchType.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum MatchType { - AutoMatch = 1, - OnePartyTradeReport = 2, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/MaxAssetFilter.ts b/binance/generated-typescript/spot_sbe/MaxAssetFilter.ts deleted file mode 100644 index edf84d6e31..0000000000 --- a/binance/generated-typescript/spot_sbe/MaxAssetFilter.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface MaxAssetFilter { - filterType: number; - qtyExponent: number; - maxQty: bigint; - asset: string; -} - -export class MaxAssetFilterDecoder { - private static readonly BLOCK_LENGTH = 9; - private static readonly TEMPLATE_ID = 21; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): MaxAssetFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const maxQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + MaxAssetFilterDecoder.BLOCK_LENGTH; - - const assetLen = view.getUint8(pos); - pos += 1; - const asset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, assetLen)); - pos += assetLen; - - return { - filterType: filterType, - qtyExponent: qtyExponent, - maxQty: maxQty, - asset: asset - }; - } - - static getBlockLength(): number { - return MaxAssetFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return MaxAssetFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return MaxAssetFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return MaxAssetFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/MaxNumAlgoOrdersFilter.ts b/binance/generated-typescript/spot_sbe/MaxNumAlgoOrdersFilter.ts deleted file mode 100644 index a3ab3d82f9..0000000000 --- a/binance/generated-typescript/spot_sbe/MaxNumAlgoOrdersFilter.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface MaxNumAlgoOrdersFilter { - filterType: number; - maxNumAlgoOrders: bigint; -} - -export class MaxNumAlgoOrdersFilterDecoder { - private static readonly BLOCK_LENGTH = 8; - private static readonly TEMPLATE_ID = 10; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): MaxNumAlgoOrdersFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const maxNumAlgoOrders = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + MaxNumAlgoOrdersFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - maxNumAlgoOrders: maxNumAlgoOrders - }; - } - - static getBlockLength(): number { - return MaxNumAlgoOrdersFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return MaxNumAlgoOrdersFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return MaxNumAlgoOrdersFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return MaxNumAlgoOrdersFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/MaxNumIcebergOrdersFilter.ts b/binance/generated-typescript/spot_sbe/MaxNumIcebergOrdersFilter.ts deleted file mode 100644 index abf8b64144..0000000000 --- a/binance/generated-typescript/spot_sbe/MaxNumIcebergOrdersFilter.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface MaxNumIcebergOrdersFilter { - filterType: number; - maxNumIcebergOrders: bigint; -} - -export class MaxNumIcebergOrdersFilterDecoder { - private static readonly BLOCK_LENGTH = 8; - private static readonly TEMPLATE_ID = 11; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): MaxNumIcebergOrdersFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const maxNumIcebergOrders = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + MaxNumIcebergOrdersFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - maxNumIcebergOrders: maxNumIcebergOrders - }; - } - - static getBlockLength(): number { - return MaxNumIcebergOrdersFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return MaxNumIcebergOrdersFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return MaxNumIcebergOrdersFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return MaxNumIcebergOrdersFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/MaxNumOrderAmendsFilter.ts b/binance/generated-typescript/spot_sbe/MaxNumOrderAmendsFilter.ts deleted file mode 100644 index dfef6497b4..0000000000 --- a/binance/generated-typescript/spot_sbe/MaxNumOrderAmendsFilter.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface MaxNumOrderAmendsFilter { - filterType: number; - maxNumOrderAmends: bigint; -} - -export class MaxNumOrderAmendsFilterDecoder { - private static readonly BLOCK_LENGTH = 8; - private static readonly TEMPLATE_ID = 20; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): MaxNumOrderAmendsFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const maxNumOrderAmends = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + MaxNumOrderAmendsFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - maxNumOrderAmends: maxNumOrderAmends - }; - } - - static getBlockLength(): number { - return MaxNumOrderAmendsFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return MaxNumOrderAmendsFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return MaxNumOrderAmendsFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return MaxNumOrderAmendsFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/MaxNumOrderListsFilter.ts b/binance/generated-typescript/spot_sbe/MaxNumOrderListsFilter.ts deleted file mode 100644 index 3b700bc33b..0000000000 --- a/binance/generated-typescript/spot_sbe/MaxNumOrderListsFilter.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface MaxNumOrderListsFilter { - filterType: number; - maxNumOrderLists: bigint; -} - -export class MaxNumOrderListsFilterDecoder { - private static readonly BLOCK_LENGTH = 8; - private static readonly TEMPLATE_ID = 18; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): MaxNumOrderListsFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const maxNumOrderLists = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + MaxNumOrderListsFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - maxNumOrderLists: maxNumOrderLists - }; - } - - static getBlockLength(): number { - return MaxNumOrderListsFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return MaxNumOrderListsFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return MaxNumOrderListsFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return MaxNumOrderListsFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/MaxNumOrdersFilter.ts b/binance/generated-typescript/spot_sbe/MaxNumOrdersFilter.ts deleted file mode 100644 index dfa7a2ef77..0000000000 --- a/binance/generated-typescript/spot_sbe/MaxNumOrdersFilter.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface MaxNumOrdersFilter { - filterType: number; - maxNumOrders: bigint; -} - -export class MaxNumOrdersFilterDecoder { - private static readonly BLOCK_LENGTH = 8; - private static readonly TEMPLATE_ID = 9; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): MaxNumOrdersFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const maxNumOrders = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + MaxNumOrdersFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - maxNumOrders: maxNumOrders - }; - } - - static getBlockLength(): number { - return MaxNumOrdersFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return MaxNumOrdersFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return MaxNumOrdersFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return MaxNumOrdersFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/MaxPositionFilter.ts b/binance/generated-typescript/spot_sbe/MaxPositionFilter.ts deleted file mode 100644 index fbf1e8af59..0000000000 --- a/binance/generated-typescript/spot_sbe/MaxPositionFilter.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface MaxPositionFilter { - filterType: number; - qtyExponent: number; - maxPosition: bigint; -} - -export class MaxPositionFilterDecoder { - private static readonly BLOCK_LENGTH = 9; - private static readonly TEMPLATE_ID = 12; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): MaxPositionFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const maxPosition = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + MaxPositionFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - qtyExponent: qtyExponent, - maxPosition: maxPosition - }; - } - - static getBlockLength(): number { - return MaxPositionFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return MaxPositionFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return MaxPositionFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return MaxPositionFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/MessageData.ts b/binance/generated-typescript/spot_sbe/MessageData.ts deleted file mode 100644 index 4e78f68c34..0000000000 --- a/binance/generated-typescript/spot_sbe/MessageData.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface MessageData { - length: number; - varData: number; -} - -export class MessageDataDecoder { - private static readonly ENCODED_LENGTH = -1; - - static decode(view: DataView, offset: number, littleEndian: boolean): MessageData { - let pos = offset; - - const length = view.getUint32(pos, littleEndian); - pos += 4; - - const varData = view.getUint8(pos); - pos += -1; - - return { - length: length, - varData: varData - }; - } - - static getEncodedLength(): number { - return MessageDataDecoder.ENCODED_LENGTH; - } -} diff --git a/binance/generated-typescript/spot_sbe/MessageData16.ts b/binance/generated-typescript/spot_sbe/MessageData16.ts deleted file mode 100644 index 96af57664f..0000000000 --- a/binance/generated-typescript/spot_sbe/MessageData16.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface MessageData16 { - length: number; - varData: number; -} - -export class MessageData16Decoder { - private static readonly ENCODED_LENGTH = -1; - - static decode(view: DataView, offset: number, littleEndian: boolean): MessageData16 { - let pos = offset; - - const length = view.getUint16(pos, littleEndian); - pos += 2; - - const varData = view.getUint8(pos); - pos += -1; - - return { - length: length, - varData: varData - }; - } - - static getEncodedLength(): number { - return MessageData16Decoder.ENCODED_LENGTH; - } -} diff --git a/binance/generated-typescript/spot_sbe/MessageData8.ts b/binance/generated-typescript/spot_sbe/MessageData8.ts deleted file mode 100644 index 56430b228d..0000000000 --- a/binance/generated-typescript/spot_sbe/MessageData8.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface MessageData8 { - length: number; - varData: number; -} - -export class MessageData8Decoder { - private static readonly ENCODED_LENGTH = -1; - - static decode(view: DataView, offset: number, littleEndian: boolean): MessageData8 { - let pos = offset; - - const length = view.getUint8(pos); - pos += 1; - - const varData = view.getUint8(pos); - pos += -1; - - return { - length: length, - varData: varData - }; - } - - static getEncodedLength(): number { - return MessageData8Decoder.ENCODED_LENGTH; - } -} diff --git a/binance/generated-typescript/spot_sbe/MessageHeader.ts b/binance/generated-typescript/spot_sbe/MessageHeader.ts deleted file mode 100644 index ed1013fc57..0000000000 --- a/binance/generated-typescript/spot_sbe/MessageHeader.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface MessageHeader { - blockLength: number; - templateId: number; - schemaId: number; - version: number; -} - -export class MessageHeaderDecoder { - private static readonly ENCODED_LENGTH = 8; - - static decode(view: DataView, offset: number, littleEndian: boolean): MessageHeader { - let pos = offset; - - const blockLength = view.getUint16(pos, littleEndian); - pos += 2; - - const templateId = view.getUint16(pos, littleEndian); - pos += 2; - - const schemaId = view.getUint16(pos, littleEndian); - pos += 2; - - const version = view.getUint16(pos, littleEndian); - pos += 2; - - return { - blockLength: blockLength, - templateId: templateId, - schemaId: schemaId, - version: version - }; - } - - static getEncodedLength(): number { - return MessageHeaderDecoder.ENCODED_LENGTH; - } -} diff --git a/binance/generated-typescript/spot_sbe/MinNotionalFilter.ts b/binance/generated-typescript/spot_sbe/MinNotionalFilter.ts deleted file mode 100644 index 17315a9b83..0000000000 --- a/binance/generated-typescript/spot_sbe/MinNotionalFilter.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface MinNotionalFilter { - filterType: number; - priceExponent: number; - minNotional: bigint; - applyToMarket: number; - avgPriceMins: number; -} - -export class MinNotionalFilterDecoder { - private static readonly BLOCK_LENGTH = 14; - private static readonly TEMPLATE_ID = 5; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): MinNotionalFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const minNotional = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const applyToMarket = view.getUint8(pos); - pos += 1; - - const avgPriceMins = view.getInt32(pos, this.littleEndian); - pos += 4; - - // Skip to end of block for forward compatibility - pos = offset + MinNotionalFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - priceExponent: priceExponent, - minNotional: minNotional, - applyToMarket: applyToMarket, - avgPriceMins: avgPriceMins - }; - } - - static getBlockLength(): number { - return MinNotionalFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return MinNotionalFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return MinNotionalFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return MinNotionalFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/MyFiltersResponse.ts b/binance/generated-typescript/spot_sbe/MyFiltersResponse.ts deleted file mode 100644 index 41e1617387..0000000000 --- a/binance/generated-typescript/spot_sbe/MyFiltersResponse.ts +++ /dev/null @@ -1,159 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface ExchangeFilters { - filter: Uint8Array; -} - -export interface SymbolFilters { - filter: Uint8Array; -} - -export interface AssetFilters { - filter: Uint8Array; -} - -export interface MyFiltersResponse { - exchangeFilters: ExchangeFilters[]; - symbolFilters: SymbolFilters[]; - assetFilters: AssetFilters[]; -} - -export class MyFiltersResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 105; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): MyFiltersResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + MyFiltersResponseDecoder.BLOCK_LENGTH; - - const exchangeFilters = this.decodeExchangeFiltersGroup(view, pos); - pos = exchangeFilters.nextOffset; - - const symbolFilters = this.decodeSymbolFiltersGroup(view, pos); - pos = symbolFilters.nextOffset; - - const assetFilters = this.decodeAssetFiltersGroup(view, pos); - pos = assetFilters.nextOffset; - - return { - exchangeFilters: exchangeFilters.items, - symbolFilters: symbolFilters.items, - assetFilters: assetFilters.items - }; - } - private decodeExchangeFiltersGroup(view: DataView, offset: number): { items: ExchangeFilters[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: ExchangeFilters[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const filterLen = view.getUint8(pos); - pos += 1; - const filter = new Uint8Array(view.buffer, view.byteOffset + pos, filterLen); - pos += filterLen; - - items.push({ - filter: filter - }); - } - - return { items, nextOffset: pos }; - } - private decodeSymbolFiltersGroup(view: DataView, offset: number): { items: SymbolFilters[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: SymbolFilters[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const filterLen = view.getUint8(pos); - pos += 1; - const filter = new Uint8Array(view.buffer, view.byteOffset + pos, filterLen); - pos += filterLen; - - items.push({ - filter: filter - }); - } - - return { items, nextOffset: pos }; - } - private decodeAssetFiltersGroup(view: DataView, offset: number): { items: AssetFilters[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: AssetFilters[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const filterLen = view.getUint8(pos); - pos += 1; - const filter = new Uint8Array(view.buffer, view.byteOffset + pos, filterLen); - pos += filterLen; - - items.push({ - filter: filter - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return MyFiltersResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return MyFiltersResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return MyFiltersResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return MyFiltersResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/NewOrderAckResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderAckResponse.ts deleted file mode 100644 index 910445d9f4..0000000000 --- a/binance/generated-typescript/spot_sbe/NewOrderAckResponse.ts +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface NewOrderAckResponse { - orderId: bigint; - orderListId: bigint; - transactTime: bigint; - symbol: string; - clientOrderId: string; -} - -export class NewOrderAckResponseDecoder { - private static readonly BLOCK_LENGTH = 24; - private static readonly TEMPLATE_ID = 300; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): NewOrderAckResponse { - const view = new DataView(buffer); - let pos = offset; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const transactTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + NewOrderAckResponseDecoder.BLOCK_LENGTH; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - return { - orderId: orderId, - orderListId: orderListId, - transactTime: transactTime, - symbol: symbol, - clientOrderId: clientOrderId - }; - } - - static getBlockLength(): number { - return NewOrderAckResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return NewOrderAckResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return NewOrderAckResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return NewOrderAckResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/NewOrderFullResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderFullResponse.ts deleted file mode 100644 index 5b9ead1ec5..0000000000 --- a/binance/generated-typescript/spot_sbe/NewOrderFullResponse.ts +++ /dev/null @@ -1,351 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Fills { - commissionExponent: number; - matchType: number; - price: bigint; - qty: bigint; - commission: bigint; - tradeId: bigint; - allocId: bigint; - commissionAsset: string; -} - -export interface PreventedMatches { - preventedMatchId: bigint; - makerOrderId: bigint; - price: bigint; - takerPreventedQuantity: bigint; - makerPreventedQuantity: bigint; - makerSymbol: string; -} - -export interface NewOrderFullResponse { - priceExponent: number; - qtyExponent: number; - orderId: bigint; - orderListId: bigint; - transactTime: bigint; - price: bigint; - origQty: bigint; - executedQty: bigint; - cummulativeQuoteQty: bigint; - status: number; - timeInForce: number; - orderType: number; - side: number; - stopPrice: bigint; - trailingDelta: bigint; - trailingTime: bigint; - workingTime: bigint; - icebergQty: bigint; - strategyId: bigint; - strategyType: number; - orderCapacity: number; - workingFloor: number; - selfTradePreventionMode: number; - tradeGroupId: bigint; - preventedQuantity: bigint; - usedSor: number; - origQuoteOrderQty: bigint; - pegPriceType: number; - pegOffsetType: number; - pegOffsetValue: number; - peggedPrice: bigint; - fills: Fills[]; - preventedMatches: PreventedMatches[]; - symbol: string; - clientOrderId: string; -} - -export class NewOrderFullResponseDecoder { - private static readonly BLOCK_LENGTH = 153; - private static readonly TEMPLATE_ID = 302; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): NewOrderFullResponse { - const view = new DataView(buffer); - let pos = offset; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const transactTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const origQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const status = view.getUint8(pos); - pos += 1; - - const timeInForce = view.getUint8(pos); - pos += 1; - - const orderType = view.getUint8(pos); - pos += 1; - - const side = view.getUint8(pos); - pos += 1; - - const stopPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const workingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const icebergQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyType = view.getInt32(pos, this.littleEndian); - pos += 4; - - const orderCapacity = view.getUint8(pos); - pos += 1; - - const workingFloor = view.getUint8(pos); - pos += 1; - - const selfTradePreventionMode = view.getUint8(pos); - pos += 1; - - const tradeGroupId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const usedSor = view.getUint8(pos); - pos += 1; - - const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const pegPriceType = view.getUint8(pos); - pos += 1; - - const pegOffsetType = view.getUint8(pos); - pos += 1; - - const pegOffsetValue = view.getUint8(pos); - pos += 1; - - const peggedPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + NewOrderFullResponseDecoder.BLOCK_LENGTH; - - const fills = this.decodeFillsGroup(view, pos); - pos = fills.nextOffset; - - const preventedMatches = this.decodePreventedMatchesGroup(view, pos); - pos = preventedMatches.nextOffset; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - return { - priceExponent: priceExponent, - qtyExponent: qtyExponent, - orderId: orderId, - orderListId: orderListId, - transactTime: transactTime, - price: price, - origQty: origQty, - executedQty: executedQty, - cummulativeQuoteQty: cummulativeQuoteQty, - status: status, - timeInForce: timeInForce, - orderType: orderType, - side: side, - stopPrice: stopPrice, - trailingDelta: trailingDelta, - trailingTime: trailingTime, - workingTime: workingTime, - icebergQty: icebergQty, - strategyId: strategyId, - strategyType: strategyType, - orderCapacity: orderCapacity, - workingFloor: workingFloor, - selfTradePreventionMode: selfTradePreventionMode, - tradeGroupId: tradeGroupId, - preventedQuantity: preventedQuantity, - usedSor: usedSor, - origQuoteOrderQty: origQuoteOrderQty, - pegPriceType: pegPriceType, - pegOffsetType: pegOffsetType, - pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice, - fills: fills.items, - preventedMatches: preventedMatches.items, - symbol: symbol, - clientOrderId: clientOrderId - }; - } - private decodeFillsGroup(view: DataView, offset: number): { items: Fills[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Fills[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const commissionExponent = view.getInt8(pos); - pos += 1; - - const matchType = view.getUint8(pos); - pos += 1; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const commission = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const tradeId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const allocId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const commissionAssetLen = view.getUint8(pos); - pos += 1; - const commissionAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, commissionAssetLen)); - pos += commissionAssetLen; - - items.push({ - commissionExponent: commissionExponent, - matchType: matchType, - price: price, - qty: qty, - commission: commission, - tradeId: tradeId, - allocId: allocId, - commissionAsset: commissionAsset - }); - } - - return { items, nextOffset: pos }; - } - private decodePreventedMatchesGroup(view: DataView, offset: number): { items: PreventedMatches[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: PreventedMatches[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const preventedMatchId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const makerOrderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const takerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const makerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const makerSymbolLen = view.getUint8(pos); - pos += 1; - const makerSymbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, makerSymbolLen)); - pos += makerSymbolLen; - - items.push({ - preventedMatchId: preventedMatchId, - makerOrderId: makerOrderId, - price: price, - takerPreventedQuantity: takerPreventedQuantity, - makerPreventedQuantity: makerPreventedQuantity, - makerSymbol: makerSymbol - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return NewOrderFullResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return NewOrderFullResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return NewOrderFullResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return NewOrderFullResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/NewOrderListAckResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderListAckResponse.ts deleted file mode 100644 index 0efd9417e2..0000000000 --- a/binance/generated-typescript/spot_sbe/NewOrderListAckResponse.ts +++ /dev/null @@ -1,195 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Orders { - orderId: bigint; - symbol: string; - clientOrderId: string; -} - -export interface OrderReports { - orderId: bigint; - orderListId: bigint; - transactTime: bigint; - symbol: string; - clientOrderId: string; -} - -export interface NewOrderListAckResponse { - orderListId: bigint; - contingencyType: number; - listStatusType: number; - listOrderStatus: number; - transactionTime: bigint; - orders: Orders[]; - orderReports: OrderReports[]; - listClientOrderId: string; - symbol: string; -} - -export class NewOrderListAckResponseDecoder { - private static readonly BLOCK_LENGTH = 19; - private static readonly TEMPLATE_ID = 309; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): NewOrderListAckResponse { - const view = new DataView(buffer); - let pos = offset; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const contingencyType = view.getUint8(pos); - pos += 1; - - const listStatusType = view.getUint8(pos); - pos += 1; - - const listOrderStatus = view.getUint8(pos); - pos += 1; - - const transactionTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + NewOrderListAckResponseDecoder.BLOCK_LENGTH; - - const orders = this.decodeOrdersGroup(view, pos); - pos = orders.nextOffset; - - const orderReports = this.decodeOrderReportsGroup(view, pos); - pos = orderReports.nextOffset; - - const listClientOrderIdLen = view.getUint8(pos); - pos += 1; - const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); - pos += listClientOrderIdLen; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - return { - orderListId: orderListId, - contingencyType: contingencyType, - listStatusType: listStatusType, - listOrderStatus: listOrderStatus, - transactionTime: transactionTime, - orders: orders.items, - orderReports: orderReports.items, - listClientOrderId: listClientOrderId, - symbol: symbol - }; - } - private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: Orders[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - orderId: orderId, - symbol: symbol, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - private decodeOrderReportsGroup(view: DataView, offset: number): { items: OrderReports[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: OrderReports[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const transactTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - orderId: orderId, - orderListId: orderListId, - transactTime: transactTime, - symbol: symbol, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return NewOrderListAckResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return NewOrderListAckResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return NewOrderListAckResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return NewOrderListAckResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/NewOrderListFullResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderListFullResponse.ts deleted file mode 100644 index 058f4a0f1f..0000000000 --- a/binance/generated-typescript/spot_sbe/NewOrderListFullResponse.ts +++ /dev/null @@ -1,469 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Orders { - orderId: bigint; - symbol: string; - clientOrderId: string; -} - -export interface Fills { - commissionExponent: number; - matchType: number; - price: bigint; - qty: bigint; - commission: bigint; - tradeId: bigint; - allocId: bigint; - commissionAsset: string; -} - -export interface PreventedMatches { - preventedMatchId: bigint; - makerOrderId: bigint; - price: bigint; - takerPreventedQuantity: bigint; - makerPreventedQuantity: bigint; - makerSymbol: string; -} - -export interface OrderReports { - orderId: bigint; - orderListId: bigint; - transactTime: bigint; - price: bigint; - origQty: bigint; - executedQty: bigint; - cummulativeQuoteQty: bigint; - status: number; - timeInForce: number; - orderType: number; - side: number; - stopPrice: bigint; - trailingDelta: bigint; - trailingTime: bigint; - workingTime: bigint; - icebergQty: bigint; - strategyId: bigint; - strategyType: number; - orderCapacity: number; - workingFloor: number; - selfTradePreventionMode: number; - tradeGroupId: bigint; - preventedQuantity: bigint; - usedSor: number; - origQuoteOrderQty: bigint; - pegPriceType: number; - pegOffsetType: number; - pegOffsetValue: number; - peggedPrice: bigint; - fills: Fills[]; - preventedMatches: PreventedMatches[]; - symbol: string; - clientOrderId: string; -} - -export interface NewOrderListFullResponse { - orderListId: bigint; - contingencyType: number; - listStatusType: number; - listOrderStatus: number; - transactionTime: bigint; - priceExponent: number; - qtyExponent: number; - orders: Orders[]; - orderReports: OrderReports[]; - listClientOrderId: string; - symbol: string; -} - -export class NewOrderListFullResponseDecoder { - private static readonly BLOCK_LENGTH = 21; - private static readonly TEMPLATE_ID = 311; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): NewOrderListFullResponse { - const view = new DataView(buffer); - let pos = offset; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const contingencyType = view.getUint8(pos); - pos += 1; - - const listStatusType = view.getUint8(pos); - pos += 1; - - const listOrderStatus = view.getUint8(pos); - pos += 1; - - const transactionTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = offset + NewOrderListFullResponseDecoder.BLOCK_LENGTH; - - const orders = this.decodeOrdersGroup(view, pos); - pos = orders.nextOffset; - - const orderReports = this.decodeOrderReportsGroup(view, pos); - pos = orderReports.nextOffset; - - const listClientOrderIdLen = view.getUint8(pos); - pos += 1; - const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); - pos += listClientOrderIdLen; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - return { - orderListId: orderListId, - contingencyType: contingencyType, - listStatusType: listStatusType, - listOrderStatus: listOrderStatus, - transactionTime: transactionTime, - priceExponent: priceExponent, - qtyExponent: qtyExponent, - orders: orders.items, - orderReports: orderReports.items, - listClientOrderId: listClientOrderId, - symbol: symbol - }; - } - private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: Orders[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - orderId: orderId, - symbol: symbol, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - private decodeOrderReportsGroup(view: DataView, offset: number): { items: OrderReports[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: OrderReports[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const transactTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const origQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const status = view.getUint8(pos); - pos += 1; - - const timeInForce = view.getUint8(pos); - pos += 1; - - const orderType = view.getUint8(pos); - pos += 1; - - const side = view.getUint8(pos); - pos += 1; - - const stopPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const workingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const icebergQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyType = view.getInt32(pos, this.littleEndian); - pos += 4; - - const orderCapacity = view.getUint8(pos); - pos += 1; - - const workingFloor = view.getUint8(pos); - pos += 1; - - const selfTradePreventionMode = view.getUint8(pos); - pos += 1; - - const tradeGroupId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const usedSor = view.getUint8(pos); - pos += 1; - - const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const pegPriceType = view.getUint8(pos); - pos += 1; - - const pegOffsetType = view.getUint8(pos); - pos += 1; - - const pegOffsetValue = view.getUint8(pos); - pos += 1; - - const peggedPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const fills = this.decodeFillsGroup(view, pos); - pos = fills.nextOffset; - - const preventedMatches = this.decodePreventedMatchesGroup(view, pos); - pos = preventedMatches.nextOffset; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - orderId: orderId, - orderListId: orderListId, - transactTime: transactTime, - price: price, - origQty: origQty, - executedQty: executedQty, - cummulativeQuoteQty: cummulativeQuoteQty, - status: status, - timeInForce: timeInForce, - orderType: orderType, - side: side, - stopPrice: stopPrice, - trailingDelta: trailingDelta, - trailingTime: trailingTime, - workingTime: workingTime, - icebergQty: icebergQty, - strategyId: strategyId, - strategyType: strategyType, - orderCapacity: orderCapacity, - workingFloor: workingFloor, - selfTradePreventionMode: selfTradePreventionMode, - tradeGroupId: tradeGroupId, - preventedQuantity: preventedQuantity, - usedSor: usedSor, - origQuoteOrderQty: origQuoteOrderQty, - pegPriceType: pegPriceType, - pegOffsetType: pegOffsetType, - pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice, - fills: fills.items, - preventedMatches: preventedMatches.items, - symbol: symbol, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - private decodeFillsGroup(view: DataView, offset: number): { items: Fills[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Fills[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const commissionExponent = view.getInt8(pos); - pos += 1; - - const matchType = view.getUint8(pos); - pos += 1; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const commission = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const tradeId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const allocId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const commissionAssetLen = view.getUint8(pos); - pos += 1; - const commissionAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, commissionAssetLen)); - pos += commissionAssetLen; - - items.push({ - commissionExponent: commissionExponent, - matchType: matchType, - price: price, - qty: qty, - commission: commission, - tradeId: tradeId, - allocId: allocId, - commissionAsset: commissionAsset - }); - } - - return { items, nextOffset: pos }; - } - private decodePreventedMatchesGroup(view: DataView, offset: number): { items: PreventedMatches[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: PreventedMatches[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const preventedMatchId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const makerOrderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const takerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const makerPreventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const makerSymbolLen = view.getUint8(pos); - pos += 1; - const makerSymbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, makerSymbolLen)); - pos += makerSymbolLen; - - items.push({ - preventedMatchId: preventedMatchId, - makerOrderId: makerOrderId, - price: price, - takerPreventedQuantity: takerPreventedQuantity, - makerPreventedQuantity: makerPreventedQuantity, - makerSymbol: makerSymbol - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return NewOrderListFullResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return NewOrderListFullResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return NewOrderListFullResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return NewOrderListFullResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/NewOrderListResultResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderListResultResponse.ts deleted file mode 100644 index fbb280d8b8..0000000000 --- a/binance/generated-typescript/spot_sbe/NewOrderListResultResponse.ts +++ /dev/null @@ -1,335 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Orders { - orderId: bigint; - symbol: string; - clientOrderId: string; -} - -export interface OrderReports { - orderId: bigint; - orderListId: bigint; - transactTime: bigint; - price: bigint; - origQty: bigint; - executedQty: bigint; - cummulativeQuoteQty: bigint; - status: number; - timeInForce: number; - orderType: number; - side: number; - stopPrice: bigint; - trailingDelta: bigint; - trailingTime: bigint; - workingTime: bigint; - icebergQty: bigint; - strategyId: bigint; - strategyType: number; - orderCapacity: number; - workingFloor: number; - selfTradePreventionMode: number; - tradeGroupId: bigint; - preventedQuantity: bigint; - usedSor: number; - origQuoteOrderQty: bigint; - pegPriceType: number; - pegOffsetType: number; - pegOffsetValue: number; - peggedPrice: bigint; - symbol: string; - clientOrderId: string; -} - -export interface NewOrderListResultResponse { - orderListId: bigint; - contingencyType: number; - listStatusType: number; - listOrderStatus: number; - transactionTime: bigint; - priceExponent: number; - qtyExponent: number; - orders: Orders[]; - orderReports: OrderReports[]; - listClientOrderId: string; - symbol: string; -} - -export class NewOrderListResultResponseDecoder { - private static readonly BLOCK_LENGTH = 21; - private static readonly TEMPLATE_ID = 310; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): NewOrderListResultResponse { - const view = new DataView(buffer); - let pos = offset; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const contingencyType = view.getUint8(pos); - pos += 1; - - const listStatusType = view.getUint8(pos); - pos += 1; - - const listOrderStatus = view.getUint8(pos); - pos += 1; - - const transactionTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = offset + NewOrderListResultResponseDecoder.BLOCK_LENGTH; - - const orders = this.decodeOrdersGroup(view, pos); - pos = orders.nextOffset; - - const orderReports = this.decodeOrderReportsGroup(view, pos); - pos = orderReports.nextOffset; - - const listClientOrderIdLen = view.getUint8(pos); - pos += 1; - const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); - pos += listClientOrderIdLen; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - return { - orderListId: orderListId, - contingencyType: contingencyType, - listStatusType: listStatusType, - listOrderStatus: listOrderStatus, - transactionTime: transactionTime, - priceExponent: priceExponent, - qtyExponent: qtyExponent, - orders: orders.items, - orderReports: orderReports.items, - listClientOrderId: listClientOrderId, - symbol: symbol - }; - } - private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: Orders[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - orderId: orderId, - symbol: symbol, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - private decodeOrderReportsGroup(view: DataView, offset: number): { items: OrderReports[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: OrderReports[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const transactTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const origQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const status = view.getUint8(pos); - pos += 1; - - const timeInForce = view.getUint8(pos); - pos += 1; - - const orderType = view.getUint8(pos); - pos += 1; - - const side = view.getUint8(pos); - pos += 1; - - const stopPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const workingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const icebergQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyType = view.getInt32(pos, this.littleEndian); - pos += 4; - - const orderCapacity = view.getUint8(pos); - pos += 1; - - const workingFloor = view.getUint8(pos); - pos += 1; - - const selfTradePreventionMode = view.getUint8(pos); - pos += 1; - - const tradeGroupId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const usedSor = view.getUint8(pos); - pos += 1; - - const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const pegPriceType = view.getUint8(pos); - pos += 1; - - const pegOffsetType = view.getUint8(pos); - pos += 1; - - const pegOffsetValue = view.getUint8(pos); - pos += 1; - - const peggedPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - orderId: orderId, - orderListId: orderListId, - transactTime: transactTime, - price: price, - origQty: origQty, - executedQty: executedQty, - cummulativeQuoteQty: cummulativeQuoteQty, - status: status, - timeInForce: timeInForce, - orderType: orderType, - side: side, - stopPrice: stopPrice, - trailingDelta: trailingDelta, - trailingTime: trailingTime, - workingTime: workingTime, - icebergQty: icebergQty, - strategyId: strategyId, - strategyType: strategyType, - orderCapacity: orderCapacity, - workingFloor: workingFloor, - selfTradePreventionMode: selfTradePreventionMode, - tradeGroupId: tradeGroupId, - preventedQuantity: preventedQuantity, - usedSor: usedSor, - origQuoteOrderQty: origQuoteOrderQty, - pegPriceType: pegPriceType, - pegOffsetType: pegOffsetType, - pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice, - symbol: symbol, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return NewOrderListResultResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return NewOrderListResultResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return NewOrderListResultResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return NewOrderListResultResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/NewOrderResultResponse.ts b/binance/generated-typescript/spot_sbe/NewOrderResultResponse.ts deleted file mode 100644 index 60311ea4a2..0000000000 --- a/binance/generated-typescript/spot_sbe/NewOrderResultResponse.ts +++ /dev/null @@ -1,217 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface NewOrderResultResponse { - priceExponent: number; - qtyExponent: number; - orderId: bigint; - orderListId: bigint; - transactTime: bigint; - price: bigint; - origQty: bigint; - executedQty: bigint; - cummulativeQuoteQty: bigint; - status: number; - timeInForce: number; - orderType: number; - side: number; - stopPrice: bigint; - trailingDelta: bigint; - trailingTime: bigint; - workingTime: bigint; - icebergQty: bigint; - strategyId: bigint; - strategyType: number; - orderCapacity: number; - workingFloor: number; - selfTradePreventionMode: number; - tradeGroupId: bigint; - preventedQuantity: bigint; - usedSor: number; - origQuoteOrderQty: bigint; - pegPriceType: number; - pegOffsetType: number; - pegOffsetValue: number; - peggedPrice: bigint; - symbol: string; - clientOrderId: string; -} - -export class NewOrderResultResponseDecoder { - private static readonly BLOCK_LENGTH = 153; - private static readonly TEMPLATE_ID = 301; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): NewOrderResultResponse { - const view = new DataView(buffer); - let pos = offset; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const transactTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const origQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const status = view.getUint8(pos); - pos += 1; - - const timeInForce = view.getUint8(pos); - pos += 1; - - const orderType = view.getUint8(pos); - pos += 1; - - const side = view.getUint8(pos); - pos += 1; - - const stopPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const workingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const icebergQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyType = view.getInt32(pos, this.littleEndian); - pos += 4; - - const orderCapacity = view.getUint8(pos); - pos += 1; - - const workingFloor = view.getUint8(pos); - pos += 1; - - const selfTradePreventionMode = view.getUint8(pos); - pos += 1; - - const tradeGroupId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const usedSor = view.getUint8(pos); - pos += 1; - - const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const pegPriceType = view.getUint8(pos); - pos += 1; - - const pegOffsetType = view.getUint8(pos); - pos += 1; - - const pegOffsetValue = view.getUint8(pos); - pos += 1; - - const peggedPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + NewOrderResultResponseDecoder.BLOCK_LENGTH; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - return { - priceExponent: priceExponent, - qtyExponent: qtyExponent, - orderId: orderId, - orderListId: orderListId, - transactTime: transactTime, - price: price, - origQty: origQty, - executedQty: executedQty, - cummulativeQuoteQty: cummulativeQuoteQty, - status: status, - timeInForce: timeInForce, - orderType: orderType, - side: side, - stopPrice: stopPrice, - trailingDelta: trailingDelta, - trailingTime: trailingTime, - workingTime: workingTime, - icebergQty: icebergQty, - strategyId: strategyId, - strategyType: strategyType, - orderCapacity: orderCapacity, - workingFloor: workingFloor, - selfTradePreventionMode: selfTradePreventionMode, - tradeGroupId: tradeGroupId, - preventedQuantity: preventedQuantity, - usedSor: usedSor, - origQuoteOrderQty: origQuoteOrderQty, - pegPriceType: pegPriceType, - pegOffsetType: pegOffsetType, - pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice, - symbol: symbol, - clientOrderId: clientOrderId - }; - } - - static getBlockLength(): number { - return NewOrderResultResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return NewOrderResultResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return NewOrderResultResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return NewOrderResultResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/NonRepresentableMessage.ts b/binance/generated-typescript/spot_sbe/NonRepresentableMessage.ts deleted file mode 100644 index 2ff12146c0..0000000000 --- a/binance/generated-typescript/spot_sbe/NonRepresentableMessage.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface NonRepresentableMessage { -} - -export class NonRepresentableMessageDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 999; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): NonRepresentableMessage { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + NonRepresentableMessageDecoder.BLOCK_LENGTH; - - return { - }; - } - - static getBlockLength(): number { - return NonRepresentableMessageDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return NonRepresentableMessageDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return NonRepresentableMessageDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return NonRepresentableMessageDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/NotionalFilter.ts b/binance/generated-typescript/spot_sbe/NotionalFilter.ts deleted file mode 100644 index 6fce4ba50a..0000000000 --- a/binance/generated-typescript/spot_sbe/NotionalFilter.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface NotionalFilter { - filterType: number; - priceExponent: number; - minNotional: bigint; - applyMinToMarket: number; - maxNotional: bigint; - applyMaxToMarket: number; - avgPriceMins: number; -} - -export class NotionalFilterDecoder { - private static readonly BLOCK_LENGTH = 23; - private static readonly TEMPLATE_ID = 6; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): NotionalFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const minNotional = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const applyMinToMarket = view.getUint8(pos); - pos += 1; - - const maxNotional = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const applyMaxToMarket = view.getUint8(pos); - pos += 1; - - const avgPriceMins = view.getInt32(pos, this.littleEndian); - pos += 4; - - // Skip to end of block for forward compatibility - pos = offset + NotionalFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - priceExponent: priceExponent, - minNotional: minNotional, - applyMinToMarket: applyMinToMarket, - maxNotional: maxNotional, - applyMaxToMarket: applyMaxToMarket, - avgPriceMins: avgPriceMins - }; - } - - static getBlockLength(): number { - return NotionalFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return NotionalFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return NotionalFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return NotionalFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/OptionalMessageData.ts b/binance/generated-typescript/spot_sbe/OptionalMessageData.ts deleted file mode 100644 index 650ec5f86d..0000000000 --- a/binance/generated-typescript/spot_sbe/OptionalMessageData.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface OptionalMessageData { - length: number; - varData: number; -} - -export class OptionalMessageDataDecoder { - private static readonly ENCODED_LENGTH = -1; - - static decode(view: DataView, offset: number, littleEndian: boolean): OptionalMessageData { - let pos = offset; - - const length = view.getUint32(pos, littleEndian); - pos += 4; - - const varData = view.getUint8(pos); - pos += -1; - - return { - length: length, - varData: varData - }; - } - - static getEncodedLength(): number { - return OptionalMessageDataDecoder.ENCODED_LENGTH; - } -} diff --git a/binance/generated-typescript/spot_sbe/OptionalMessageData16.ts b/binance/generated-typescript/spot_sbe/OptionalMessageData16.ts deleted file mode 100644 index 4d95470642..0000000000 --- a/binance/generated-typescript/spot_sbe/OptionalMessageData16.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface OptionalMessageData16 { - length: number; - varData: number; -} - -export class OptionalMessageData16Decoder { - private static readonly ENCODED_LENGTH = -1; - - static decode(view: DataView, offset: number, littleEndian: boolean): OptionalMessageData16 { - let pos = offset; - - const length = view.getUint16(pos, littleEndian); - pos += 2; - - const varData = view.getUint8(pos); - pos += -1; - - return { - length: length, - varData: varData - }; - } - - static getEncodedLength(): number { - return OptionalMessageData16Decoder.ENCODED_LENGTH; - } -} diff --git a/binance/generated-typescript/spot_sbe/OptionalVarString.ts b/binance/generated-typescript/spot_sbe/OptionalVarString.ts deleted file mode 100644 index 4c74932df6..0000000000 --- a/binance/generated-typescript/spot_sbe/OptionalVarString.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface OptionalVarString { - length: number; - varData: number; -} - -export class OptionalVarStringDecoder { - private static readonly ENCODED_LENGTH = -1; - - static decode(view: DataView, offset: number, littleEndian: boolean): OptionalVarString { - let pos = offset; - - const length = view.getUint16(pos, littleEndian); - pos += 2; - - const varData = view.getUint8(pos); - pos += -1; - - return { - length: length, - varData: varData - }; - } - - static getEncodedLength(): number { - return OptionalVarStringDecoder.ENCODED_LENGTH; - } -} diff --git a/binance/generated-typescript/spot_sbe/OptionalVarString8.ts b/binance/generated-typescript/spot_sbe/OptionalVarString8.ts deleted file mode 100644 index 0edbd8091a..0000000000 --- a/binance/generated-typescript/spot_sbe/OptionalVarString8.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface OptionalVarString8 { - length: number; - varData: number; -} - -export class OptionalVarString8Decoder { - private static readonly ENCODED_LENGTH = -1; - - static decode(view: DataView, offset: number, littleEndian: boolean): OptionalVarString8 { - let pos = offset; - - const length = view.getUint8(pos); - pos += 1; - - const varData = view.getUint8(pos); - pos += -1; - - return { - length: length, - varData: varData - }; - } - - static getEncodedLength(): number { - return OptionalVarString8Decoder.ENCODED_LENGTH; - } -} diff --git a/binance/generated-typescript/spot_sbe/OrderAmendKeepPriorityResponse.ts b/binance/generated-typescript/spot_sbe/OrderAmendKeepPriorityResponse.ts deleted file mode 100644 index 08c6498517..0000000000 --- a/binance/generated-typescript/spot_sbe/OrderAmendKeepPriorityResponse.ts +++ /dev/null @@ -1,501 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Orders { - orderId: bigint; - symbol: string; - clientOrderId: string; -} - -export interface ListStatus { - orderListId: bigint; - contingencyType: number; - listOrderStatus: number; - orders: Orders[]; - listClientOrderId: string; - symbol: string; -} - -export interface RelatedOrders { - orderId: bigint; - orderListId: bigint; - price: bigint; - qty: bigint; - executedQty: bigint; - preventedQty: bigint; - cumulativeQuoteQty: bigint; - status: number; - timeInForce: number; - orderType: number; - side: number; - stopPrice: bigint; - trailingDelta: bigint; - trailingTime: bigint; - icebergQty: bigint; - workingTime: bigint; - strategyId: bigint; - strategyType: number; - orderCapacity: number; - workingFloor: number; - selfTradePreventionMode: number; - usedSor: number; - pegPriceType: number; - pegOffsetType: number; - pegOffsetValue: number; - peggedPrice: bigint; - symbol: string; - clientOrderId: string; -} - -export interface OrderAmendKeepPriorityResponse { - transactTime: bigint; - executionId: bigint; - priceExponent: number; - qtyExponent: number; - orderId: bigint; - orderListId: bigint; - price: bigint; - qty: bigint; - executedQty: bigint; - preventedQty: bigint; - cumulativeQuoteQty: bigint; - status: number; - timeInForce: number; - orderType: number; - side: number; - stopPrice: bigint; - trailingDelta: bigint; - trailingTime: bigint; - icebergQty: bigint; - workingTime: bigint; - strategyId: bigint; - strategyType: number; - orderCapacity: number; - workingFloor: number; - selfTradePreventionMode: number; - usedSor: number; - pegPriceType: number; - pegOffsetType: number; - pegOffsetValue: number; - peggedPrice: bigint; - listStatus: ListStatus[]; - relatedOrders: RelatedOrders[]; - symbol: string; - origClientOrderId: string; - clientOrderId: string; -} - -export class OrderAmendKeepPriorityResponseDecoder { - private static readonly BLOCK_LENGTH = 145; - private static readonly TEMPLATE_ID = 317; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): OrderAmendKeepPriorityResponse { - const view = new DataView(buffer); - let pos = offset; - - const transactTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executionId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const cumulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const status = view.getUint8(pos); - pos += 1; - - const timeInForce = view.getUint8(pos); - pos += 1; - - const orderType = view.getUint8(pos); - pos += 1; - - const side = view.getUint8(pos); - pos += 1; - - const stopPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const icebergQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const workingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyType = view.getInt32(pos, this.littleEndian); - pos += 4; - - const orderCapacity = view.getUint8(pos); - pos += 1; - - const workingFloor = view.getUint8(pos); - pos += 1; - - const selfTradePreventionMode = view.getUint8(pos); - pos += 1; - - const usedSor = view.getUint8(pos); - pos += 1; - - const pegPriceType = view.getUint8(pos); - pos += 1; - - const pegOffsetType = view.getUint8(pos); - pos += 1; - - const pegOffsetValue = view.getUint8(pos); - pos += 1; - - const peggedPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + OrderAmendKeepPriorityResponseDecoder.BLOCK_LENGTH; - - const listStatus = this.decodeListStatusGroup(view, pos); - pos = listStatus.nextOffset; - - const relatedOrders = this.decodeRelatedOrdersGroup(view, pos); - pos = relatedOrders.nextOffset; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const origClientOrderIdLen = view.getUint8(pos); - pos += 1; - const origClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, origClientOrderIdLen)); - pos += origClientOrderIdLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - return { - transactTime: transactTime, - executionId: executionId, - priceExponent: priceExponent, - qtyExponent: qtyExponent, - orderId: orderId, - orderListId: orderListId, - price: price, - qty: qty, - executedQty: executedQty, - preventedQty: preventedQty, - cumulativeQuoteQty: cumulativeQuoteQty, - status: status, - timeInForce: timeInForce, - orderType: orderType, - side: side, - stopPrice: stopPrice, - trailingDelta: trailingDelta, - trailingTime: trailingTime, - icebergQty: icebergQty, - workingTime: workingTime, - strategyId: strategyId, - strategyType: strategyType, - orderCapacity: orderCapacity, - workingFloor: workingFloor, - selfTradePreventionMode: selfTradePreventionMode, - usedSor: usedSor, - pegPriceType: pegPriceType, - pegOffsetType: pegOffsetType, - pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice, - listStatus: listStatus.items, - relatedOrders: relatedOrders.items, - symbol: symbol, - origClientOrderId: origClientOrderId, - clientOrderId: clientOrderId - }; - } - private decodeListStatusGroup(view: DataView, offset: number): { items: ListStatus[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: ListStatus[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const contingencyType = view.getUint8(pos); - pos += 1; - - const listOrderStatus = view.getUint8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const orders = this.decodeOrdersGroup(view, pos); - pos = orders.nextOffset; - - const listClientOrderIdLen = view.getUint8(pos); - pos += 1; - const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); - pos += listClientOrderIdLen; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - items.push({ - orderListId: orderListId, - contingencyType: contingencyType, - listOrderStatus: listOrderStatus, - orders: orders.items, - listClientOrderId: listClientOrderId, - symbol: symbol - }); - } - - return { items, nextOffset: pos }; - } - private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: Orders[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - orderId: orderId, - symbol: symbol, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - private decodeRelatedOrdersGroup(view: DataView, offset: number): { items: RelatedOrders[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: RelatedOrders[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const cumulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const status = view.getUint8(pos); - pos += 1; - - const timeInForce = view.getUint8(pos); - pos += 1; - - const orderType = view.getUint8(pos); - pos += 1; - - const side = view.getUint8(pos); - pos += 1; - - const stopPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const icebergQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const workingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyType = view.getInt32(pos, this.littleEndian); - pos += 4; - - const orderCapacity = view.getUint8(pos); - pos += 1; - - const workingFloor = view.getUint8(pos); - pos += 1; - - const selfTradePreventionMode = view.getUint8(pos); - pos += 1; - - const usedSor = view.getUint8(pos); - pos += 1; - - const pegPriceType = view.getUint8(pos); - pos += 1; - - const pegOffsetType = view.getUint8(pos); - pos += 1; - - const pegOffsetValue = view.getUint8(pos); - pos += 1; - - const peggedPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - orderId: orderId, - orderListId: orderListId, - price: price, - qty: qty, - executedQty: executedQty, - preventedQty: preventedQty, - cumulativeQuoteQty: cumulativeQuoteQty, - status: status, - timeInForce: timeInForce, - orderType: orderType, - side: side, - stopPrice: stopPrice, - trailingDelta: trailingDelta, - trailingTime: trailingTime, - icebergQty: icebergQty, - workingTime: workingTime, - strategyId: strategyId, - strategyType: strategyType, - orderCapacity: orderCapacity, - workingFloor: workingFloor, - selfTradePreventionMode: selfTradePreventionMode, - usedSor: usedSor, - pegPriceType: pegPriceType, - pegOffsetType: pegOffsetType, - pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice, - symbol: symbol, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return OrderAmendKeepPriorityResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return OrderAmendKeepPriorityResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return OrderAmendKeepPriorityResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return OrderAmendKeepPriorityResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/OrderAmendmentsResponse.ts b/binance/generated-typescript/spot_sbe/OrderAmendmentsResponse.ts deleted file mode 100644 index dcb35e5471..0000000000 --- a/binance/generated-typescript/spot_sbe/OrderAmendmentsResponse.ts +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Amendments { - orderId: bigint; - executionId: bigint; - qtyExponent: number; - origQty: bigint; - newQty: bigint; - time: bigint; - symbol: string; - origClientOrderId: string; - newClientOrderId: string; -} - -export interface OrderAmendmentsResponse { - amendments: Amendments[]; -} - -export class OrderAmendmentsResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 316; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): OrderAmendmentsResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + OrderAmendmentsResponseDecoder.BLOCK_LENGTH; - - const amendments = this.decodeAmendmentsGroup(view, pos); - pos = amendments.nextOffset; - - return { - amendments: amendments.items - }; - } - private decodeAmendmentsGroup(view: DataView, offset: number): { items: Amendments[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Amendments[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executionId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const origQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const newQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const time = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const origClientOrderIdLen = view.getUint8(pos); - pos += 1; - const origClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, origClientOrderIdLen)); - pos += origClientOrderIdLen; - - const newClientOrderIdLen = view.getUint8(pos); - pos += 1; - const newClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, newClientOrderIdLen)); - pos += newClientOrderIdLen; - - items.push({ - orderId: orderId, - executionId: executionId, - qtyExponent: qtyExponent, - origQty: origQty, - newQty: newQty, - time: time, - symbol: symbol, - origClientOrderId: origClientOrderId, - newClientOrderId: newClientOrderId - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return OrderAmendmentsResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return OrderAmendmentsResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return OrderAmendmentsResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return OrderAmendmentsResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/OrderCapacity.ts b/binance/generated-typescript/spot_sbe/OrderCapacity.ts deleted file mode 100644 index cd64464d66..0000000000 --- a/binance/generated-typescript/spot_sbe/OrderCapacity.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum OrderCapacity { - Principal = 1, - Agency = 2, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/OrderListResponse.ts b/binance/generated-typescript/spot_sbe/OrderListResponse.ts deleted file mode 100644 index 0ff3910dd7..0000000000 --- a/binance/generated-typescript/spot_sbe/OrderListResponse.ts +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Orders { - orderId: bigint; - symbol: string; - clientOrderId: string; -} - -export interface OrderListResponse { - orderListId: bigint; - contingencyType: number; - listStatusType: number; - listOrderStatus: number; - transactionTime: bigint; - orders: Orders[]; - listClientOrderId: string; - symbol: string; -} - -export class OrderListResponseDecoder { - private static readonly BLOCK_LENGTH = 19; - private static readonly TEMPLATE_ID = 313; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): OrderListResponse { - const view = new DataView(buffer); - let pos = offset; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const contingencyType = view.getUint8(pos); - pos += 1; - - const listStatusType = view.getUint8(pos); - pos += 1; - - const listOrderStatus = view.getUint8(pos); - pos += 1; - - const transactionTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + OrderListResponseDecoder.BLOCK_LENGTH; - - const orders = this.decodeOrdersGroup(view, pos); - pos = orders.nextOffset; - - const listClientOrderIdLen = view.getUint8(pos); - pos += 1; - const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); - pos += listClientOrderIdLen; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - return { - orderListId: orderListId, - contingencyType: contingencyType, - listStatusType: listStatusType, - listOrderStatus: listOrderStatus, - transactionTime: transactionTime, - orders: orders.items, - listClientOrderId: listClientOrderId, - symbol: symbol - }; - } - private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: Orders[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - orderId: orderId, - symbol: symbol, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return OrderListResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return OrderListResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return OrderListResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return OrderListResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/OrderListsResponse.ts b/binance/generated-typescript/spot_sbe/OrderListsResponse.ts deleted file mode 100644 index cbcd7b4df3..0000000000 --- a/binance/generated-typescript/spot_sbe/OrderListsResponse.ts +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Orders { - orderId: bigint; - symbol: string; - clientOrderId: string; -} - -export interface OrderLists { - orderListId: bigint; - contingencyType: number; - listStatusType: number; - listOrderStatus: number; - transactionTime: bigint; - orders: Orders[]; - listClientOrderId: string; - symbol: string; -} - -export interface OrderListsResponse { - orderLists: OrderLists[]; -} - -export class OrderListsResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 314; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): OrderListsResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + OrderListsResponseDecoder.BLOCK_LENGTH; - - const orderLists = this.decodeOrderListsGroup(view, pos); - pos = orderLists.nextOffset; - - return { - orderLists: orderLists.items - }; - } - private decodeOrderListsGroup(view: DataView, offset: number): { items: OrderLists[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: OrderLists[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const contingencyType = view.getUint8(pos); - pos += 1; - - const listStatusType = view.getUint8(pos); - pos += 1; - - const listOrderStatus = view.getUint8(pos); - pos += 1; - - const transactionTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const orders = this.decodeOrdersGroup(view, pos); - pos = orders.nextOffset; - - const listClientOrderIdLen = view.getUint8(pos); - pos += 1; - const listClientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listClientOrderIdLen)); - pos += listClientOrderIdLen; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - items.push({ - orderListId: orderListId, - contingencyType: contingencyType, - listStatusType: listStatusType, - listOrderStatus: listOrderStatus, - transactionTime: transactionTime, - orders: orders.items, - listClientOrderId: listClientOrderId, - symbol: symbol - }); - } - - return { items, nextOffset: pos }; - } - private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Orders[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - orderId: orderId, - symbol: symbol, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return OrderListsResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return OrderListsResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return OrderListsResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return OrderListsResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/OrderResponse.ts b/binance/generated-typescript/spot_sbe/OrderResponse.ts deleted file mode 100644 index a12ae3e894..0000000000 --- a/binance/generated-typescript/spot_sbe/OrderResponse.ts +++ /dev/null @@ -1,227 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface OrderResponse { - priceExponent: number; - qtyExponent: number; - orderId: bigint; - orderListId: bigint; - price: bigint; - origQty: bigint; - executedQty: bigint; - cummulativeQuoteQty: bigint; - status: number; - timeInForce: number; - orderType: number; - side: number; - stopPrice: bigint; - trailingDelta: bigint; - trailingTime: bigint; - icebergQty: bigint; - time: bigint; - updateTime: bigint; - isWorking: number; - workingTime: bigint; - origQuoteOrderQty: bigint; - strategyId: bigint; - strategyType: number; - orderCapacity: number; - workingFloor: number; - selfTradePreventionMode: number; - preventedMatchId: bigint; - preventedQuantity: bigint; - usedSor: number; - pegPriceType: number; - pegOffsetType: number; - pegOffsetValue: number; - peggedPrice: bigint; - symbol: string; - clientOrderId: string; -} - -export class OrderResponseDecoder { - private static readonly BLOCK_LENGTH = 162; - private static readonly TEMPLATE_ID = 304; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): OrderResponse { - const view = new DataView(buffer); - let pos = offset; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const origQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const status = view.getUint8(pos); - pos += 1; - - const timeInForce = view.getUint8(pos); - pos += 1; - - const orderType = view.getUint8(pos); - pos += 1; - - const side = view.getUint8(pos); - pos += 1; - - const stopPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const icebergQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const time = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const updateTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const isWorking = view.getUint8(pos); - pos += 1; - - const workingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyType = view.getInt32(pos, this.littleEndian); - pos += 4; - - const orderCapacity = view.getUint8(pos); - pos += 1; - - const workingFloor = view.getUint8(pos); - pos += 1; - - const selfTradePreventionMode = view.getUint8(pos); - pos += 1; - - const preventedMatchId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const usedSor = view.getUint8(pos); - pos += 1; - - const pegPriceType = view.getUint8(pos); - pos += 1; - - const pegOffsetType = view.getUint8(pos); - pos += 1; - - const pegOffsetValue = view.getUint8(pos); - pos += 1; - - const peggedPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + OrderResponseDecoder.BLOCK_LENGTH; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - return { - priceExponent: priceExponent, - qtyExponent: qtyExponent, - orderId: orderId, - orderListId: orderListId, - price: price, - origQty: origQty, - executedQty: executedQty, - cummulativeQuoteQty: cummulativeQuoteQty, - status: status, - timeInForce: timeInForce, - orderType: orderType, - side: side, - stopPrice: stopPrice, - trailingDelta: trailingDelta, - trailingTime: trailingTime, - icebergQty: icebergQty, - time: time, - updateTime: updateTime, - isWorking: isWorking, - workingTime: workingTime, - origQuoteOrderQty: origQuoteOrderQty, - strategyId: strategyId, - strategyType: strategyType, - orderCapacity: orderCapacity, - workingFloor: workingFloor, - selfTradePreventionMode: selfTradePreventionMode, - preventedMatchId: preventedMatchId, - preventedQuantity: preventedQuantity, - usedSor: usedSor, - pegPriceType: pegPriceType, - pegOffsetType: pegOffsetType, - pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice, - symbol: symbol, - clientOrderId: clientOrderId - }; - } - - static getBlockLength(): number { - return OrderResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return OrderResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return OrderResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return OrderResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/OrderSide.ts b/binance/generated-typescript/spot_sbe/OrderSide.ts deleted file mode 100644 index 8514b5681f..0000000000 --- a/binance/generated-typescript/spot_sbe/OrderSide.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum OrderSide { - Buy = 0, - Sell = 1, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/OrderStatus.ts b/binance/generated-typescript/spot_sbe/OrderStatus.ts deleted file mode 100644 index 8de912ded9..0000000000 --- a/binance/generated-typescript/spot_sbe/OrderStatus.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum OrderStatus { - New = 0, - PartiallyFilled = 1, - Filled = 2, - Canceled = 3, - PendingCancel = 4, - Rejected = 5, - Expired = 6, - ExpiredInMatch = 9, - PendingNew = 11, - Unknown = 253, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/OrderTestResponse.ts b/binance/generated-typescript/spot_sbe/OrderTestResponse.ts deleted file mode 100644 index c5f2132a37..0000000000 --- a/binance/generated-typescript/spot_sbe/OrderTestResponse.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface OrderTestResponse { -} - -export class OrderTestResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 303; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): OrderTestResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + OrderTestResponseDecoder.BLOCK_LENGTH; - - return { - }; - } - - static getBlockLength(): number { - return OrderTestResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return OrderTestResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return OrderTestResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return OrderTestResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/OrderTestWithCommissionsResponse.ts b/binance/generated-typescript/spot_sbe/OrderTestWithCommissionsResponse.ts deleted file mode 100644 index 64a9b1a9a6..0000000000 --- a/binance/generated-typescript/spot_sbe/OrderTestWithCommissionsResponse.ts +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface OrderTestWithCommissionsResponse { - commissionExponent: number; - discountExponent: number; - standardCommissionForOrderMaker: bigint; - standardCommissionForOrderTaker: bigint; - taxCommissionForOrderMaker: bigint; - taxCommissionForOrderTaker: bigint; - discountEnabledForAccount: number; - discountEnabledForSymbol: number; - discount: bigint; - specialCommissionForOrderMaker: bigint; - specialCommissionForOrderTaker: bigint; - discountAsset: string; -} - -export class OrderTestWithCommissionsResponseDecoder { - private static readonly BLOCK_LENGTH = 60; - private static readonly TEMPLATE_ID = 315; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): OrderTestWithCommissionsResponse { - const view = new DataView(buffer); - let pos = offset; - - const commissionExponent = view.getInt8(pos); - pos += 1; - - const discountExponent = view.getInt8(pos); - pos += 1; - - const standardCommissionForOrderMaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const standardCommissionForOrderTaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const taxCommissionForOrderMaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const taxCommissionForOrderTaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const discountEnabledForAccount = view.getUint8(pos); - pos += 1; - - const discountEnabledForSymbol = view.getUint8(pos); - pos += 1; - - const discount = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const specialCommissionForOrderMaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const specialCommissionForOrderTaker = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + OrderTestWithCommissionsResponseDecoder.BLOCK_LENGTH; - - const discountAssetLen = view.getUint8(pos); - pos += 1; - const discountAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, discountAssetLen)); - pos += discountAssetLen; - - return { - commissionExponent: commissionExponent, - discountExponent: discountExponent, - standardCommissionForOrderMaker: standardCommissionForOrderMaker, - standardCommissionForOrderTaker: standardCommissionForOrderTaker, - taxCommissionForOrderMaker: taxCommissionForOrderMaker, - taxCommissionForOrderTaker: taxCommissionForOrderTaker, - discountEnabledForAccount: discountEnabledForAccount, - discountEnabledForSymbol: discountEnabledForSymbol, - discount: discount, - specialCommissionForOrderMaker: specialCommissionForOrderMaker, - specialCommissionForOrderTaker: specialCommissionForOrderTaker, - discountAsset: discountAsset - }; - } - - static getBlockLength(): number { - return OrderTestWithCommissionsResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return OrderTestWithCommissionsResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return OrderTestWithCommissionsResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return OrderTestWithCommissionsResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/OrderType.ts b/binance/generated-typescript/spot_sbe/OrderType.ts deleted file mode 100644 index a55a656883..0000000000 --- a/binance/generated-typescript/spot_sbe/OrderType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum OrderType { - Market = 0, - Limit = 1, - StopLoss = 2, - StopLossLimit = 3, - TakeProfit = 4, - TakeProfitLimit = 5, - LimitMaker = 6, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/OrderTypes.ts b/binance/generated-typescript/spot_sbe/OrderTypes.ts deleted file mode 100644 index 07c3125a68..0000000000 --- a/binance/generated-typescript/spot_sbe/OrderTypes.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface OrderTypes { - market: boolean; - limit: boolean; - stopLoss: boolean; - stopLossLimit: boolean; - takeProfit: boolean; - takeProfitLimit: boolean; - limitMaker: boolean; - nonRepresentable: boolean; -} - -export class OrderTypesDecoder { - static decode(view: DataView, offset: number, littleEndian: boolean): OrderTypes { - const bits = view.getUint16(offset, littleEndian); - - return { - market: (bits & (1 << 0)) !== 0, - limit: (bits & (1 << 1)) !== 0, - stopLoss: (bits & (1 << 2)) !== 0, - stopLossLimit: (bits & (1 << 3)) !== 0, - takeProfit: (bits & (1 << 4)) !== 0, - takeProfitLimit: (bits & (1 << 5)) !== 0, - limitMaker: (bits & (1 << 6)) !== 0, - nonRepresentable: (bits & (1 << 15)) !== 0 - }; - } - - static getEncodedLength(): number { - return 2; - } -} diff --git a/binance/generated-typescript/spot_sbe/OrdersResponse.ts b/binance/generated-typescript/spot_sbe/OrdersResponse.ts deleted file mode 100644 index 87f404ddbf..0000000000 --- a/binance/generated-typescript/spot_sbe/OrdersResponse.ts +++ /dev/null @@ -1,257 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Orders { - priceExponent: number; - qtyExponent: number; - orderId: bigint; - orderListId: bigint; - price: bigint; - origQty: bigint; - executedQty: bigint; - cummulativeQuoteQty: bigint; - status: number; - timeInForce: number; - orderType: number; - side: number; - stopPrice: bigint; - trailingDelta: bigint; - trailingTime: bigint; - icebergQty: bigint; - time: bigint; - updateTime: bigint; - isWorking: number; - workingTime: bigint; - origQuoteOrderQty: bigint; - strategyId: bigint; - strategyType: number; - orderCapacity: number; - workingFloor: number; - selfTradePreventionMode: number; - preventedMatchId: bigint; - preventedQuantity: bigint; - usedSor: number; - pegPriceType: number; - pegOffsetType: number; - pegOffsetValue: number; - peggedPrice: bigint; - symbol: string; - clientOrderId: string; -} - -export interface OrdersResponse { - orders: Orders[]; -} - -export class OrdersResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 308; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): OrdersResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + OrdersResponseDecoder.BLOCK_LENGTH; - - const orders = this.decodeOrdersGroup(view, pos); - pos = orders.nextOffset; - - return { - orders: orders.items - }; - } - private decodeOrdersGroup(view: DataView, offset: number): { items: Orders[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Orders[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const orderId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const orderListId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const origQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const executedQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const cummulativeQuoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const status = view.getUint8(pos); - pos += 1; - - const timeInForce = view.getUint8(pos); - pos += 1; - - const orderType = view.getUint8(pos); - pos += 1; - - const side = view.getUint8(pos); - pos += 1; - - const stopPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const trailingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const icebergQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const time = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const updateTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const isWorking = view.getUint8(pos); - pos += 1; - - const workingTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const origQuoteOrderQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const strategyType = view.getInt32(pos, this.littleEndian); - pos += 4; - - const orderCapacity = view.getUint8(pos); - pos += 1; - - const workingFloor = view.getUint8(pos); - pos += 1; - - const selfTradePreventionMode = view.getUint8(pos); - pos += 1; - - const preventedMatchId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const preventedQuantity = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const usedSor = view.getUint8(pos); - pos += 1; - - const pegPriceType = view.getUint8(pos); - pos += 1; - - const pegOffsetType = view.getUint8(pos); - pos += 1; - - const pegOffsetValue = view.getUint8(pos); - pos += 1; - - const peggedPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const clientOrderIdLen = view.getUint8(pos); - pos += 1; - const clientOrderId = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, clientOrderIdLen)); - pos += clientOrderIdLen; - - items.push({ - priceExponent: priceExponent, - qtyExponent: qtyExponent, - orderId: orderId, - orderListId: orderListId, - price: price, - origQty: origQty, - executedQty: executedQty, - cummulativeQuoteQty: cummulativeQuoteQty, - status: status, - timeInForce: timeInForce, - orderType: orderType, - side: side, - stopPrice: stopPrice, - trailingDelta: trailingDelta, - trailingTime: trailingTime, - icebergQty: icebergQty, - time: time, - updateTime: updateTime, - isWorking: isWorking, - workingTime: workingTime, - origQuoteOrderQty: origQuoteOrderQty, - strategyId: strategyId, - strategyType: strategyType, - orderCapacity: orderCapacity, - workingFloor: workingFloor, - selfTradePreventionMode: selfTradePreventionMode, - preventedMatchId: preventedMatchId, - preventedQuantity: preventedQuantity, - usedSor: usedSor, - pegPriceType: pegPriceType, - pegOffsetType: pegOffsetType, - pegOffsetValue: pegOffsetValue, - peggedPrice: peggedPrice, - symbol: symbol, - clientOrderId: clientOrderId - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return OrdersResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return OrdersResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return OrdersResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return OrdersResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/OutboundAccountPositionEvent.ts b/binance/generated-typescript/spot_sbe/OutboundAccountPositionEvent.ts deleted file mode 100644 index 702645d48b..0000000000 --- a/binance/generated-typescript/spot_sbe/OutboundAccountPositionEvent.ts +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Balances { - exponent: number; - free: bigint; - locked: bigint; - asset: string; -} - -export interface OutboundAccountPositionEvent { - eventTime: bigint; - updateTime: bigint; - subscriptionId: number; - balances: Balances[]; -} - -export class OutboundAccountPositionEventDecoder { - private static readonly BLOCK_LENGTH = 18; - private static readonly TEMPLATE_ID = 607; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): OutboundAccountPositionEvent { - const view = new DataView(buffer); - let pos = offset; - - const eventTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const updateTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const subscriptionId = view.getUint16(pos, this.littleEndian); - pos += 2; - - // Skip to end of block for forward compatibility - pos = offset + OutboundAccountPositionEventDecoder.BLOCK_LENGTH; - - const balances = this.decodeBalancesGroup(view, pos); - pos = balances.nextOffset; - - return { - eventTime: eventTime, - updateTime: updateTime, - subscriptionId: subscriptionId, - balances: balances.items - }; - } - private decodeBalancesGroup(view: DataView, offset: number): { items: Balances[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Balances[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const exponent = view.getInt8(pos); - pos += 1; - - const free = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const locked = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const assetLen = view.getUint8(pos); - pos += 1; - const asset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, assetLen)); - pos += assetLen; - - items.push({ - exponent: exponent, - free: free, - locked: locked, - asset: asset - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return OutboundAccountPositionEventDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return OutboundAccountPositionEventDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return OutboundAccountPositionEventDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return OutboundAccountPositionEventDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/PegOffsetType.ts b/binance/generated-typescript/spot_sbe/PegOffsetType.ts deleted file mode 100644 index 65d1a988e5..0000000000 --- a/binance/generated-typescript/spot_sbe/PegOffsetType.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum PegOffsetType { - PriceLevel = 1, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/PegPriceType.ts b/binance/generated-typescript/spot_sbe/PegPriceType.ts deleted file mode 100644 index a9bfa456ab..0000000000 --- a/binance/generated-typescript/spot_sbe/PegPriceType.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum PegPriceType { - PrimaryPeg = 1, - MarketPeg = 2, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/PercentPriceBySideFilter.ts b/binance/generated-typescript/spot_sbe/PercentPriceBySideFilter.ts deleted file mode 100644 index ccb0ea7806..0000000000 --- a/binance/generated-typescript/spot_sbe/PercentPriceBySideFilter.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface PercentPriceBySideFilter { - filterType: number; - multiplierExponent: number; - bidMultiplierUp: bigint; - bidMultiplierDown: bigint; - askMultiplierUp: bigint; - askMultiplierDown: bigint; - avgPriceMins: number; -} - -export class PercentPriceBySideFilterDecoder { - private static readonly BLOCK_LENGTH = 37; - private static readonly TEMPLATE_ID = 3; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): PercentPriceBySideFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const multiplierExponent = view.getInt8(pos); - pos += 1; - - const bidMultiplierUp = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const bidMultiplierDown = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const askMultiplierUp = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const askMultiplierDown = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const avgPriceMins = view.getInt32(pos, this.littleEndian); - pos += 4; - - // Skip to end of block for forward compatibility - pos = offset + PercentPriceBySideFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - multiplierExponent: multiplierExponent, - bidMultiplierUp: bidMultiplierUp, - bidMultiplierDown: bidMultiplierDown, - askMultiplierUp: askMultiplierUp, - askMultiplierDown: askMultiplierDown, - avgPriceMins: avgPriceMins - }; - } - - static getBlockLength(): number { - return PercentPriceBySideFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return PercentPriceBySideFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return PercentPriceBySideFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return PercentPriceBySideFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/PercentPriceFilter.ts b/binance/generated-typescript/spot_sbe/PercentPriceFilter.ts deleted file mode 100644 index a045453127..0000000000 --- a/binance/generated-typescript/spot_sbe/PercentPriceFilter.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface PercentPriceFilter { - filterType: number; - multiplierExponent: number; - multiplierUp: bigint; - multiplierDown: bigint; - avgPriceMins: number; -} - -export class PercentPriceFilterDecoder { - private static readonly BLOCK_LENGTH = 21; - private static readonly TEMPLATE_ID = 2; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): PercentPriceFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const multiplierExponent = view.getInt8(pos); - pos += 1; - - const multiplierUp = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const multiplierDown = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const avgPriceMins = view.getInt32(pos, this.littleEndian); - pos += 4; - - // Skip to end of block for forward compatibility - pos = offset + PercentPriceFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - multiplierExponent: multiplierExponent, - multiplierUp: multiplierUp, - multiplierDown: multiplierDown, - avgPriceMins: avgPriceMins - }; - } - - static getBlockLength(): number { - return PercentPriceFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return PercentPriceFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return PercentPriceFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return PercentPriceFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/PingResponse.ts b/binance/generated-typescript/spot_sbe/PingResponse.ts deleted file mode 100644 index 35d935ca08..0000000000 --- a/binance/generated-typescript/spot_sbe/PingResponse.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface PingResponse { -} - -export class PingResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 101; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): PingResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + PingResponseDecoder.BLOCK_LENGTH; - - return { - }; - } - - static getBlockLength(): number { - return PingResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return PingResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return PingResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return PingResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/PriceFilter.ts b/binance/generated-typescript/spot_sbe/PriceFilter.ts deleted file mode 100644 index 2961fa3102..0000000000 --- a/binance/generated-typescript/spot_sbe/PriceFilter.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface PriceFilter { - filterType: number; - priceExponent: number; - minPrice: bigint; - maxPrice: bigint; - tickSize: bigint; -} - -export class PriceFilterDecoder { - private static readonly BLOCK_LENGTH = 25; - private static readonly TEMPLATE_ID = 1; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): PriceFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const minPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const maxPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const tickSize = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + PriceFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - priceExponent: priceExponent, - minPrice: minPrice, - maxPrice: maxPrice, - tickSize: tickSize - }; - } - - static getBlockLength(): number { - return PriceFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return PriceFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return PriceFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return PriceFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/PriceTickerResponse.ts b/binance/generated-typescript/spot_sbe/PriceTickerResponse.ts deleted file mode 100644 index a1ac0d55da..0000000000 --- a/binance/generated-typescript/spot_sbe/PriceTickerResponse.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Tickers { - priceExponent: number; - price: bigint; - symbol: string; -} - -export interface PriceTickerResponse { - tickers: Tickers[]; -} - -export class PriceTickerResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 210; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): PriceTickerResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + PriceTickerResponseDecoder.BLOCK_LENGTH; - - const tickers = this.decodeTickersGroup(view, pos); - pos = tickers.nextOffset; - - return { - tickers: tickers.items - }; - } - private decodeTickersGroup(view: DataView, offset: number): { items: Tickers[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Tickers[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - items.push({ - priceExponent: priceExponent, - price: price, - symbol: symbol - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return PriceTickerResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return PriceTickerResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return PriceTickerResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return PriceTickerResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/PriceTickerSymbolResponse.ts b/binance/generated-typescript/spot_sbe/PriceTickerSymbolResponse.ts deleted file mode 100644 index d5bee8a41c..0000000000 --- a/binance/generated-typescript/spot_sbe/PriceTickerSymbolResponse.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface PriceTickerSymbolResponse { - priceExponent: number; - price: bigint; - symbol: string; -} - -export class PriceTickerSymbolResponseDecoder { - private static readonly BLOCK_LENGTH = 9; - private static readonly TEMPLATE_ID = 209; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): PriceTickerSymbolResponse { - const view = new DataView(buffer); - let pos = offset; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + PriceTickerSymbolResponseDecoder.BLOCK_LENGTH; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - return { - priceExponent: priceExponent, - price: price, - symbol: symbol - }; - } - - static getBlockLength(): number { - return PriceTickerSymbolResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return PriceTickerSymbolResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return PriceTickerSymbolResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return PriceTickerSymbolResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/RateLimitInterval.ts b/binance/generated-typescript/spot_sbe/RateLimitInterval.ts deleted file mode 100644 index a822cd404f..0000000000 --- a/binance/generated-typescript/spot_sbe/RateLimitInterval.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum RateLimitInterval { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/RateLimitType.ts b/binance/generated-typescript/spot_sbe/RateLimitType.ts deleted file mode 100644 index 6eadce6667..0000000000 --- a/binance/generated-typescript/spot_sbe/RateLimitType.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum RateLimitType { - RawRequests = 0, - Connections = 1, - RequestWeight = 2, - Orders = 3, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/SelfTradePreventionMode.ts b/binance/generated-typescript/spot_sbe/SelfTradePreventionMode.ts deleted file mode 100644 index 2b8234236c..0000000000 --- a/binance/generated-typescript/spot_sbe/SelfTradePreventionMode.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum SelfTradePreventionMode { - None = 1, - ExpireTaker = 2, - ExpireMaker = 3, - ExpireBoth = 4, - Decrement = 5, - Transfer = 6, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/ServerTimeResponse.ts b/binance/generated-typescript/spot_sbe/ServerTimeResponse.ts deleted file mode 100644 index c0d4f9d191..0000000000 --- a/binance/generated-typescript/spot_sbe/ServerTimeResponse.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface ServerTimeResponse { - serverTime: bigint; -} - -export class ServerTimeResponseDecoder { - private static readonly BLOCK_LENGTH = 8; - private static readonly TEMPLATE_ID = 102; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): ServerTimeResponse { - const view = new DataView(buffer); - let pos = offset; - - const serverTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + ServerTimeResponseDecoder.BLOCK_LENGTH; - - return { - serverTime: serverTime - }; - } - - static getBlockLength(): number { - return ServerTimeResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return ServerTimeResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return ServerTimeResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return ServerTimeResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/SymbolStatus.ts b/binance/generated-typescript/spot_sbe/SymbolStatus.ts deleted file mode 100644 index 351a2d1bf2..0000000000 --- a/binance/generated-typescript/spot_sbe/SymbolStatus.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum SymbolStatus { - Trading = 0, - EndOfDay = 1, - Halt = 2, - Break = 3, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/TPlusFilterLockEvent.ts b/binance/generated-typescript/spot_sbe/TPlusFilterLockEvent.ts deleted file mode 100644 index 5d22413a08..0000000000 --- a/binance/generated-typescript/spot_sbe/TPlusFilterLockEvent.ts +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface UnlockData { - unlockTime: bigint; - qty: bigint; -} - -export interface TPlusFilterLockEvent { - eventTime: bigint; - qtyExponent: number; - subscriptionId: number; - unlockData: UnlockData[]; - symbol: string; - baseAsset: string; -} - -export class TPlusFilterLockEventDecoder { - private static readonly BLOCK_LENGTH = 11; - private static readonly TEMPLATE_ID = 608; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): TPlusFilterLockEvent { - const view = new DataView(buffer); - let pos = offset; - - const eventTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const subscriptionId = view.getUint16(pos, this.littleEndian); - pos += 2; - - // Skip to end of block for forward compatibility - pos = offset + TPlusFilterLockEventDecoder.BLOCK_LENGTH; - - const unlockData = this.decodeUnlockDataGroup(view, pos); - pos = unlockData.nextOffset; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - const baseAssetLen = view.getUint8(pos); - pos += 1; - const baseAsset = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, baseAssetLen)); - pos += baseAssetLen; - - return { - eventTime: eventTime, - qtyExponent: qtyExponent, - subscriptionId: subscriptionId, - unlockData: unlockData.items, - symbol: symbol, - baseAsset: baseAsset - }; - } - private decodeUnlockDataGroup(view: DataView, offset: number): { items: UnlockData[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: UnlockData[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const unlockTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - items.push({ - unlockTime: unlockTime, - qty: qty - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return TPlusFilterLockEventDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return TPlusFilterLockEventDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return TPlusFilterLockEventDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return TPlusFilterLockEventDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/TPlusSellFilter.ts b/binance/generated-typescript/spot_sbe/TPlusSellFilter.ts deleted file mode 100644 index d773942ede..0000000000 --- a/binance/generated-typescript/spot_sbe/TPlusSellFilter.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface TPlusSellFilter { - filterType: number; - endTime: bigint; -} - -export class TPlusSellFilterDecoder { - private static readonly BLOCK_LENGTH = 8; - private static readonly TEMPLATE_ID = 14; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): TPlusSellFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const endTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + TPlusSellFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - endTime: endTime - }; - } - - static getBlockLength(): number { - return TPlusSellFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return TPlusSellFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return TPlusSellFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return TPlusSellFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/Ticker24hFullResponse.ts b/binance/generated-typescript/spot_sbe/Ticker24hFullResponse.ts deleted file mode 100644 index 643c66e6c7..0000000000 --- a/binance/generated-typescript/spot_sbe/Ticker24hFullResponse.ts +++ /dev/null @@ -1,195 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Tickers { - priceExponent: number; - qtyExponent: number; - priceChange: bigint; - priceChangePercent: number; - weightedAvgPrice: bigint; - prevClosePrice: bigint; - lastPrice: bigint; - lastQty: number; - bidPrice: bigint; - bidQty: bigint; - askPrice: bigint; - askQty: bigint; - openPrice: bigint; - highPrice: bigint; - lowPrice: bigint; - volume: number; - quoteVolume: number; - openTime: bigint; - closeTime: bigint; - firstId: bigint; - lastId: bigint; - numTrades: bigint; - symbol: string; -} - -export interface Ticker24hFullResponse { - tickers: Tickers[]; -} - -export class Ticker24hFullResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 206; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): Ticker24hFullResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + Ticker24hFullResponseDecoder.BLOCK_LENGTH; - - const tickers = this.decodeTickersGroup(view, pos); - pos = tickers.nextOffset; - - return { - tickers: tickers.items - }; - } - private decodeTickersGroup(view: DataView, offset: number): { items: Tickers[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Tickers[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const priceChange = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const priceChangePercent = view.getFloat32(pos, this.littleEndian); - pos += 4; - - const weightedAvgPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const prevClosePrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastQty = view.getUint8(pos); - pos += 16; - - const bidPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const bidQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const askPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const askQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const openPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const highPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lowPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const volume = view.getUint8(pos); - pos += 16; - - const quoteVolume = view.getUint8(pos); - pos += 16; - - const openTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const closeTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const firstId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const numTrades = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - items.push({ - priceExponent: priceExponent, - qtyExponent: qtyExponent, - priceChange: priceChange, - priceChangePercent: priceChangePercent, - weightedAvgPrice: weightedAvgPrice, - prevClosePrice: prevClosePrice, - lastPrice: lastPrice, - lastQty: lastQty, - bidPrice: bidPrice, - bidQty: bidQty, - askPrice: askPrice, - askQty: askQty, - openPrice: openPrice, - highPrice: highPrice, - lowPrice: lowPrice, - volume: volume, - quoteVolume: quoteVolume, - openTime: openTime, - closeTime: closeTime, - firstId: firstId, - lastId: lastId, - numTrades: numTrades, - symbol: symbol - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return Ticker24hFullResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return Ticker24hFullResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return Ticker24hFullResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return Ticker24hFullResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/Ticker24hMiniResponse.ts b/binance/generated-typescript/spot_sbe/Ticker24hMiniResponse.ts deleted file mode 100644 index afe296ebda..0000000000 --- a/binance/generated-typescript/spot_sbe/Ticker24hMiniResponse.ts +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Tickers { - priceExponent: number; - qtyExponent: number; - openPrice: bigint; - highPrice: bigint; - lowPrice: bigint; - lastPrice: bigint; - volume: number; - quoteVolume: number; - openTime: bigint; - closeTime: bigint; - firstId: bigint; - lastId: bigint; - numTrades: bigint; - symbol: string; -} - -export interface Ticker24hMiniResponse { - tickers: Tickers[]; -} - -export class Ticker24hMiniResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 208; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): Ticker24hMiniResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + Ticker24hMiniResponseDecoder.BLOCK_LENGTH; - - const tickers = this.decodeTickersGroup(view, pos); - pos = tickers.nextOffset; - - return { - tickers: tickers.items - }; - } - private decodeTickersGroup(view: DataView, offset: number): { items: Tickers[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Tickers[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const openPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const highPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lowPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const volume = view.getUint8(pos); - pos += 16; - - const quoteVolume = view.getUint8(pos); - pos += 16; - - const openTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const closeTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const firstId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const numTrades = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - items.push({ - priceExponent: priceExponent, - qtyExponent: qtyExponent, - openPrice: openPrice, - highPrice: highPrice, - lowPrice: lowPrice, - lastPrice: lastPrice, - volume: volume, - quoteVolume: quoteVolume, - openTime: openTime, - closeTime: closeTime, - firstId: firstId, - lastId: lastId, - numTrades: numTrades, - symbol: symbol - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return Ticker24hMiniResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return Ticker24hMiniResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return Ticker24hMiniResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return Ticker24hMiniResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/Ticker24hSymbolFullResponse.ts b/binance/generated-typescript/spot_sbe/Ticker24hSymbolFullResponse.ts deleted file mode 100644 index 9291f42ab8..0000000000 --- a/binance/generated-typescript/spot_sbe/Ticker24hSymbolFullResponse.ts +++ /dev/null @@ -1,165 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Ticker24hSymbolFullResponse { - priceExponent: number; - qtyExponent: number; - priceChange: bigint; - priceChangePercent: number; - weightedAvgPrice: bigint; - prevClosePrice: bigint; - lastPrice: bigint; - lastQty: number; - bidPrice: bigint; - bidQty: bigint; - askPrice: bigint; - askQty: bigint; - openPrice: bigint; - highPrice: bigint; - lowPrice: bigint; - volume: number; - quoteVolume: number; - openTime: bigint; - closeTime: bigint; - firstId: bigint; - lastId: bigint; - numTrades: bigint; - symbol: string; -} - -export class Ticker24hSymbolFullResponseDecoder { - private static readonly BLOCK_LENGTH = 182; - private static readonly TEMPLATE_ID = 205; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): Ticker24hSymbolFullResponse { - const view = new DataView(buffer); - let pos = offset; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const priceChange = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const priceChangePercent = view.getFloat32(pos, this.littleEndian); - pos += 4; - - const weightedAvgPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const prevClosePrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastQty = view.getUint8(pos); - pos += 16; - - const bidPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const bidQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const askPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const askQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const openPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const highPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lowPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const volume = view.getUint8(pos); - pos += 16; - - const quoteVolume = view.getUint8(pos); - pos += 16; - - const openTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const closeTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const firstId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const numTrades = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + Ticker24hSymbolFullResponseDecoder.BLOCK_LENGTH; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - return { - priceExponent: priceExponent, - qtyExponent: qtyExponent, - priceChange: priceChange, - priceChangePercent: priceChangePercent, - weightedAvgPrice: weightedAvgPrice, - prevClosePrice: prevClosePrice, - lastPrice: lastPrice, - lastQty: lastQty, - bidPrice: bidPrice, - bidQty: bidQty, - askPrice: askPrice, - askQty: askQty, - openPrice: openPrice, - highPrice: highPrice, - lowPrice: lowPrice, - volume: volume, - quoteVolume: quoteVolume, - openTime: openTime, - closeTime: closeTime, - firstId: firstId, - lastId: lastId, - numTrades: numTrades, - symbol: symbol - }; - } - - static getBlockLength(): number { - return Ticker24hSymbolFullResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return Ticker24hSymbolFullResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return Ticker24hSymbolFullResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return Ticker24hSymbolFullResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/Ticker24hSymbolMiniResponse.ts b/binance/generated-typescript/spot_sbe/Ticker24hSymbolMiniResponse.ts deleted file mode 100644 index bb87abc89c..0000000000 --- a/binance/generated-typescript/spot_sbe/Ticker24hSymbolMiniResponse.ts +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Ticker24hSymbolMiniResponse { - priceExponent: number; - qtyExponent: number; - openPrice: bigint; - highPrice: bigint; - lowPrice: bigint; - lastPrice: bigint; - volume: number; - quoteVolume: number; - openTime: bigint; - closeTime: bigint; - firstId: bigint; - lastId: bigint; - numTrades: bigint; - symbol: string; -} - -export class Ticker24hSymbolMiniResponseDecoder { - private static readonly BLOCK_LENGTH = 106; - private static readonly TEMPLATE_ID = 207; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): Ticker24hSymbolMiniResponse { - const view = new DataView(buffer); - let pos = offset; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const openPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const highPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lowPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const volume = view.getUint8(pos); - pos += 16; - - const quoteVolume = view.getUint8(pos); - pos += 16; - - const openTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const closeTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const firstId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const numTrades = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + Ticker24hSymbolMiniResponseDecoder.BLOCK_LENGTH; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - return { - priceExponent: priceExponent, - qtyExponent: qtyExponent, - openPrice: openPrice, - highPrice: highPrice, - lowPrice: lowPrice, - lastPrice: lastPrice, - volume: volume, - quoteVolume: quoteVolume, - openTime: openTime, - closeTime: closeTime, - firstId: firstId, - lastId: lastId, - numTrades: numTrades, - symbol: symbol - }; - } - - static getBlockLength(): number { - return Ticker24hSymbolMiniResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return Ticker24hSymbolMiniResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return Ticker24hSymbolMiniResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return Ticker24hSymbolMiniResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/TickerFullResponse.ts b/binance/generated-typescript/spot_sbe/TickerFullResponse.ts deleted file mode 100644 index c97af60e9a..0000000000 --- a/binance/generated-typescript/spot_sbe/TickerFullResponse.ts +++ /dev/null @@ -1,165 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Tickers { - priceExponent: number; - qtyExponent: number; - priceChange: bigint; - priceChangePercent: number; - weightedAvgPrice: bigint; - openPrice: bigint; - highPrice: bigint; - lowPrice: bigint; - lastPrice: bigint; - volume: number; - quoteVolume: number; - openTime: bigint; - closeTime: bigint; - firstId: bigint; - lastId: bigint; - numTrades: bigint; - symbol: string; -} - -export interface TickerFullResponse { - tickers: Tickers[]; -} - -export class TickerFullResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 214; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): TickerFullResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + TickerFullResponseDecoder.BLOCK_LENGTH; - - const tickers = this.decodeTickersGroup(view, pos); - pos = tickers.nextOffset; - - return { - tickers: tickers.items - }; - } - private decodeTickersGroup(view: DataView, offset: number): { items: Tickers[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Tickers[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const priceChange = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const priceChangePercent = view.getFloat32(pos, this.littleEndian); - pos += 4; - - const weightedAvgPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const openPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const highPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lowPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const volume = view.getUint8(pos); - pos += 16; - - const quoteVolume = view.getUint8(pos); - pos += 16; - - const openTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const closeTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const firstId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const numTrades = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - items.push({ - priceExponent: priceExponent, - qtyExponent: qtyExponent, - priceChange: priceChange, - priceChangePercent: priceChangePercent, - weightedAvgPrice: weightedAvgPrice, - openPrice: openPrice, - highPrice: highPrice, - lowPrice: lowPrice, - lastPrice: lastPrice, - volume: volume, - quoteVolume: quoteVolume, - openTime: openTime, - closeTime: closeTime, - firstId: firstId, - lastId: lastId, - numTrades: numTrades, - symbol: symbol - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return TickerFullResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return TickerFullResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return TickerFullResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return TickerFullResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/TickerMiniResponse.ts b/binance/generated-typescript/spot_sbe/TickerMiniResponse.ts deleted file mode 100644 index 4a5281f321..0000000000 --- a/binance/generated-typescript/spot_sbe/TickerMiniResponse.ts +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Tickers { - priceExponent: number; - qtyExponent: number; - openPrice: bigint; - highPrice: bigint; - lowPrice: bigint; - lastPrice: bigint; - volume: number; - quoteVolume: number; - openTime: bigint; - closeTime: bigint; - firstId: bigint; - lastId: bigint; - numTrades: bigint; - symbol: string; -} - -export interface TickerMiniResponse { - tickers: Tickers[]; -} - -export class TickerMiniResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 216; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): TickerMiniResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + TickerMiniResponseDecoder.BLOCK_LENGTH; - - const tickers = this.decodeTickersGroup(view, pos); - pos = tickers.nextOffset; - - return { - tickers: tickers.items - }; - } - private decodeTickersGroup(view: DataView, offset: number): { items: Tickers[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Tickers[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const openPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const highPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lowPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const volume = view.getUint8(pos); - pos += 16; - - const quoteVolume = view.getUint8(pos); - pos += 16; - - const openTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const closeTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const firstId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const numTrades = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - items.push({ - priceExponent: priceExponent, - qtyExponent: qtyExponent, - openPrice: openPrice, - highPrice: highPrice, - lowPrice: lowPrice, - lastPrice: lastPrice, - volume: volume, - quoteVolume: quoteVolume, - openTime: openTime, - closeTime: closeTime, - firstId: firstId, - lastId: lastId, - numTrades: numTrades, - symbol: symbol - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return TickerMiniResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return TickerMiniResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return TickerMiniResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return TickerMiniResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/TickerSymbolFullResponse.ts b/binance/generated-typescript/spot_sbe/TickerSymbolFullResponse.ts deleted file mode 100644 index 055803ef56..0000000000 --- a/binance/generated-typescript/spot_sbe/TickerSymbolFullResponse.ts +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface TickerSymbolFullResponse { - priceExponent: number; - qtyExponent: number; - priceChange: bigint; - priceChangePercent: number; - weightedAvgPrice: bigint; - openPrice: bigint; - highPrice: bigint; - lowPrice: bigint; - lastPrice: bigint; - volume: number; - quoteVolume: number; - openTime: bigint; - closeTime: bigint; - firstId: bigint; - lastId: bigint; - numTrades: bigint; - symbol: string; -} - -export class TickerSymbolFullResponseDecoder { - private static readonly BLOCK_LENGTH = 126; - private static readonly TEMPLATE_ID = 213; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): TickerSymbolFullResponse { - const view = new DataView(buffer); - let pos = offset; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const priceChange = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const priceChangePercent = view.getFloat32(pos, this.littleEndian); - pos += 4; - - const weightedAvgPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const openPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const highPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lowPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const volume = view.getUint8(pos); - pos += 16; - - const quoteVolume = view.getUint8(pos); - pos += 16; - - const openTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const closeTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const firstId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const numTrades = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + TickerSymbolFullResponseDecoder.BLOCK_LENGTH; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - return { - priceExponent: priceExponent, - qtyExponent: qtyExponent, - priceChange: priceChange, - priceChangePercent: priceChangePercent, - weightedAvgPrice: weightedAvgPrice, - openPrice: openPrice, - highPrice: highPrice, - lowPrice: lowPrice, - lastPrice: lastPrice, - volume: volume, - quoteVolume: quoteVolume, - openTime: openTime, - closeTime: closeTime, - firstId: firstId, - lastId: lastId, - numTrades: numTrades, - symbol: symbol - }; - } - - static getBlockLength(): number { - return TickerSymbolFullResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return TickerSymbolFullResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return TickerSymbolFullResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return TickerSymbolFullResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/TickerSymbolMiniResponse.ts b/binance/generated-typescript/spot_sbe/TickerSymbolMiniResponse.ts deleted file mode 100644 index 83365248a3..0000000000 --- a/binance/generated-typescript/spot_sbe/TickerSymbolMiniResponse.ts +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface TickerSymbolMiniResponse { - priceExponent: number; - qtyExponent: number; - openPrice: bigint; - highPrice: bigint; - lowPrice: bigint; - lastPrice: bigint; - volume: number; - quoteVolume: number; - openTime: bigint; - closeTime: bigint; - firstId: bigint; - lastId: bigint; - numTrades: bigint; - symbol: string; -} - -export class TickerSymbolMiniResponseDecoder { - private static readonly BLOCK_LENGTH = 106; - private static readonly TEMPLATE_ID = 215; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): TickerSymbolMiniResponse { - const view = new DataView(buffer); - let pos = offset; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - const openPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const highPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lowPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastPrice = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const volume = view.getUint8(pos); - pos += 16; - - const quoteVolume = view.getUint8(pos); - pos += 16; - - const openTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const closeTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const firstId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const lastId = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const numTrades = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + TickerSymbolMiniResponseDecoder.BLOCK_LENGTH; - - const symbolLen = view.getUint8(pos); - pos += 1; - const symbol = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, symbolLen)); - pos += symbolLen; - - return { - priceExponent: priceExponent, - qtyExponent: qtyExponent, - openPrice: openPrice, - highPrice: highPrice, - lowPrice: lowPrice, - lastPrice: lastPrice, - volume: volume, - quoteVolume: quoteVolume, - openTime: openTime, - closeTime: closeTime, - firstId: firstId, - lastId: lastId, - numTrades: numTrades, - symbol: symbol - }; - } - - static getBlockLength(): number { - return TickerSymbolMiniResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return TickerSymbolMiniResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return TickerSymbolMiniResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return TickerSymbolMiniResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/TimeInForce.ts b/binance/generated-typescript/spot_sbe/TimeInForce.ts deleted file mode 100644 index da3ee329d9..0000000000 --- a/binance/generated-typescript/spot_sbe/TimeInForce.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export enum TimeInForce { - Gtc = 0, - Ioc = 1, - Fok = 2, - NonRepresentable = 254 -} diff --git a/binance/generated-typescript/spot_sbe/TradesResponse.ts b/binance/generated-typescript/spot_sbe/TradesResponse.ts deleted file mode 100644 index ebaf17829e..0000000000 --- a/binance/generated-typescript/spot_sbe/TradesResponse.ts +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Trades { - id: bigint; - price: bigint; - qty: bigint; - quoteQty: bigint; - time: bigint; - isBuyerMaker: number; - isBestMatch: number; -} - -export interface TradesResponse { - priceExponent: number; - qtyExponent: number; - trades: Trades[]; -} - -export class TradesResponseDecoder { - private static readonly BLOCK_LENGTH = 2; - private static readonly TEMPLATE_ID = 201; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): TradesResponse { - const view = new DataView(buffer); - let pos = offset; - - const priceExponent = view.getInt8(pos); - pos += 1; - - const qtyExponent = view.getInt8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = offset + TradesResponseDecoder.BLOCK_LENGTH; - - const trades = this.decodeTradesGroup(view, pos); - pos = trades.nextOffset; - - return { - priceExponent: priceExponent, - qtyExponent: qtyExponent, - trades: trades.items - }; - } - private decodeTradesGroup(view: DataView, offset: number): { items: Trades[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Trades[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const id = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const price = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const qty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const quoteQty = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const time = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const isBuyerMaker = view.getUint8(pos); - pos += 1; - - const isBestMatch = view.getUint8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - items.push({ - id: id, - price: price, - qty: qty, - quoteQty: quoteQty, - time: time, - isBuyerMaker: isBuyerMaker, - isBestMatch: isBestMatch - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return TradesResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return TradesResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return TradesResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return TradesResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/TrailingDeltaFilter.ts b/binance/generated-typescript/spot_sbe/TrailingDeltaFilter.ts deleted file mode 100644 index 020903dab9..0000000000 --- a/binance/generated-typescript/spot_sbe/TrailingDeltaFilter.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface TrailingDeltaFilter { - filterType: number; - minTrailingAboveDelta: bigint; - maxTrailingAboveDelta: bigint; - minTrailingBelowDelta: bigint; - maxTrailingBelowDelta: bigint; -} - -export class TrailingDeltaFilterDecoder { - private static readonly BLOCK_LENGTH = 32; - private static readonly TEMPLATE_ID = 13; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): TrailingDeltaFilter { - const view = new DataView(buffer); - let pos = offset; - - const filterType = view.getUint8(pos); - pos += 1; - - const minTrailingAboveDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const maxTrailingAboveDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const minTrailingBelowDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const maxTrailingBelowDelta = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + TrailingDeltaFilterDecoder.BLOCK_LENGTH; - - return { - filterType: filterType, - minTrailingAboveDelta: minTrailingAboveDelta, - maxTrailingAboveDelta: maxTrailingAboveDelta, - minTrailingBelowDelta: minTrailingBelowDelta, - maxTrailingBelowDelta: maxTrailingBelowDelta - }; - } - - static getBlockLength(): number { - return TrailingDeltaFilterDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return TrailingDeltaFilterDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return TrailingDeltaFilterDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return TrailingDeltaFilterDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/UserDataStreamPingResponse.ts b/binance/generated-typescript/spot_sbe/UserDataStreamPingResponse.ts deleted file mode 100644 index 5908a035b2..0000000000 --- a/binance/generated-typescript/spot_sbe/UserDataStreamPingResponse.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface UserDataStreamPingResponse { -} - -export class UserDataStreamPingResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 501; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): UserDataStreamPingResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + UserDataStreamPingResponseDecoder.BLOCK_LENGTH; - - return { - }; - } - - static getBlockLength(): number { - return UserDataStreamPingResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return UserDataStreamPingResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return UserDataStreamPingResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return UserDataStreamPingResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/UserDataStreamStartResponse.ts b/binance/generated-typescript/spot_sbe/UserDataStreamStartResponse.ts deleted file mode 100644 index 636b09f4c1..0000000000 --- a/binance/generated-typescript/spot_sbe/UserDataStreamStartResponse.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface UserDataStreamStartResponse { - listenKey: string; -} - -export class UserDataStreamStartResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 500; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): UserDataStreamStartResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + UserDataStreamStartResponseDecoder.BLOCK_LENGTH; - - const listenKeyLen = view.getUint8(pos); - pos += 1; - const listenKey = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, listenKeyLen)); - pos += listenKeyLen; - - return { - listenKey: listenKey - }; - } - - static getBlockLength(): number { - return UserDataStreamStartResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return UserDataStreamStartResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return UserDataStreamStartResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return UserDataStreamStartResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/UserDataStreamStopResponse.ts b/binance/generated-typescript/spot_sbe/UserDataStreamStopResponse.ts deleted file mode 100644 index d82dd93b8c..0000000000 --- a/binance/generated-typescript/spot_sbe/UserDataStreamStopResponse.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface UserDataStreamStopResponse { -} - -export class UserDataStreamStopResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 502; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): UserDataStreamStopResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + UserDataStreamStopResponseDecoder.BLOCK_LENGTH; - - return { - }; - } - - static getBlockLength(): number { - return UserDataStreamStopResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return UserDataStreamStopResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return UserDataStreamStopResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return UserDataStreamStopResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/UserDataStreamSubscribeListenTokenResponse.ts b/binance/generated-typescript/spot_sbe/UserDataStreamSubscribeListenTokenResponse.ts deleted file mode 100644 index dcdbba95cf..0000000000 --- a/binance/generated-typescript/spot_sbe/UserDataStreamSubscribeListenTokenResponse.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface UserDataStreamSubscribeListenTokenResponse { - subscriptionId: number; - expirationTime: bigint; -} - -export class UserDataStreamSubscribeListenTokenResponseDecoder { - private static readonly BLOCK_LENGTH = 10; - private static readonly TEMPLATE_ID = 505; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): UserDataStreamSubscribeListenTokenResponse { - const view = new DataView(buffer); - let pos = offset; - - const subscriptionId = view.getUint16(pos, this.littleEndian); - pos += 2; - - const expirationTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = offset + UserDataStreamSubscribeListenTokenResponseDecoder.BLOCK_LENGTH; - - return { - subscriptionId: subscriptionId, - expirationTime: expirationTime - }; - } - - static getBlockLength(): number { - return UserDataStreamSubscribeListenTokenResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return UserDataStreamSubscribeListenTokenResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return UserDataStreamSubscribeListenTokenResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return UserDataStreamSubscribeListenTokenResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/UserDataStreamSubscribeResponse.ts b/binance/generated-typescript/spot_sbe/UserDataStreamSubscribeResponse.ts deleted file mode 100644 index b9fa71f9ee..0000000000 --- a/binance/generated-typescript/spot_sbe/UserDataStreamSubscribeResponse.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface UserDataStreamSubscribeResponse { - subscriptionId: number; -} - -export class UserDataStreamSubscribeResponseDecoder { - private static readonly BLOCK_LENGTH = 2; - private static readonly TEMPLATE_ID = 503; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): UserDataStreamSubscribeResponse { - const view = new DataView(buffer); - let pos = offset; - - const subscriptionId = view.getUint16(pos, this.littleEndian); - pos += 2; - - // Skip to end of block for forward compatibility - pos = offset + UserDataStreamSubscribeResponseDecoder.BLOCK_LENGTH; - - return { - subscriptionId: subscriptionId - }; - } - - static getBlockLength(): number { - return UserDataStreamSubscribeResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return UserDataStreamSubscribeResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return UserDataStreamSubscribeResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return UserDataStreamSubscribeResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/UserDataStreamUnsubscribeResponse.ts b/binance/generated-typescript/spot_sbe/UserDataStreamUnsubscribeResponse.ts deleted file mode 100644 index c27da32f91..0000000000 --- a/binance/generated-typescript/spot_sbe/UserDataStreamUnsubscribeResponse.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface UserDataStreamUnsubscribeResponse { -} - -export class UserDataStreamUnsubscribeResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 504; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): UserDataStreamUnsubscribeResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + UserDataStreamUnsubscribeResponseDecoder.BLOCK_LENGTH; - - return { - }; - } - - static getBlockLength(): number { - return UserDataStreamUnsubscribeResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return UserDataStreamUnsubscribeResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return UserDataStreamUnsubscribeResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return UserDataStreamUnsubscribeResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/VarString.ts b/binance/generated-typescript/spot_sbe/VarString.ts deleted file mode 100644 index e216b684c5..0000000000 --- a/binance/generated-typescript/spot_sbe/VarString.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface VarString { - length: number; - varData: number; -} - -export class VarStringDecoder { - private static readonly ENCODED_LENGTH = -1; - - static decode(view: DataView, offset: number, littleEndian: boolean): VarString { - let pos = offset; - - const length = view.getUint16(pos, littleEndian); - pos += 2; - - const varData = view.getUint8(pos); - pos += -1; - - return { - length: length, - varData: varData - }; - } - - static getEncodedLength(): number { - return VarStringDecoder.ENCODED_LENGTH; - } -} diff --git a/binance/generated-typescript/spot_sbe/VarString8.ts b/binance/generated-typescript/spot_sbe/VarString8.ts deleted file mode 100644 index e7f25b580a..0000000000 --- a/binance/generated-typescript/spot_sbe/VarString8.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface VarString8 { - length: number; - varData: number; -} - -export class VarString8Decoder { - private static readonly ENCODED_LENGTH = -1; - - static decode(view: DataView, offset: number, littleEndian: boolean): VarString8 { - let pos = offset; - - const length = view.getUint8(pos); - pos += 1; - - const varData = view.getUint8(pos); - pos += -1; - - return { - length: length, - varData: varData - }; - } - - static getEncodedLength(): number { - return VarString8Decoder.ENCODED_LENGTH; - } -} diff --git a/binance/generated-typescript/spot_sbe/WebSocketResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketResponse.ts deleted file mode 100644 index e548921d8d..0000000000 --- a/binance/generated-typescript/spot_sbe/WebSocketResponse.ts +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface RateLimits { - rateLimitType: number; - interval: number; - intervalNum: number; - rateLimit: bigint; - current: bigint; -} - -export interface WebSocketResponse { - sbeSchemaIdVersionDeprecated: number; - status: number; - rateLimits: RateLimits[]; - id: string; - result: Uint8Array; -} - -export class WebSocketResponseDecoder { - private static readonly BLOCK_LENGTH = 3; - private static readonly TEMPLATE_ID = 50; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): WebSocketResponse { - const view = new DataView(buffer); - let pos = offset; - - const sbeSchemaIdVersionDeprecated = view.getUint8(pos); - pos += 1; - - const status = view.getUint16(pos, this.littleEndian); - pos += 2; - - // Skip to end of block for forward compatibility - pos = offset + WebSocketResponseDecoder.BLOCK_LENGTH; - - const rateLimits = this.decodeRateLimitsGroup(view, pos); - pos = rateLimits.nextOffset; - - const idLen = view.getUint8(pos); - pos += 1; - const id = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, idLen)); - pos += idLen; - - const resultLen = view.getUint32(pos, this.littleEndian); - pos += 4; - const result = new Uint8Array(view.buffer, view.byteOffset + pos, resultLen); - pos += resultLen; - - return { - sbeSchemaIdVersionDeprecated: sbeSchemaIdVersionDeprecated, - status: status, - rateLimits: rateLimits.items, - id: id, - result: result - }; - } - private decodeRateLimitsGroup(view: DataView, offset: number): { items: RateLimits[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint16(pos, this.littleEndian); - pos += 2; - - const items: RateLimits[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const rateLimitType = view.getUint8(pos); - pos += 1; - - const interval = view.getUint8(pos); - pos += 1; - - const intervalNum = view.getUint8(pos); - pos += 1; - - const rateLimit = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const current = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - items.push({ - rateLimitType: rateLimitType, - interval: interval, - intervalNum: intervalNum, - rateLimit: rateLimit, - current: current - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return WebSocketResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return WebSocketResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return WebSocketResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return WebSocketResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/WebSocketSessionLogonResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketSessionLogonResponse.ts deleted file mode 100644 index 53cd9f451e..0000000000 --- a/binance/generated-typescript/spot_sbe/WebSocketSessionLogonResponse.ts +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface WebSocketSessionLogonResponse { - authorizedSince: bigint; - connectedSince: bigint; - returnRateLimits: number; - serverTime: bigint; - userDataStream: number; - loggedOnApiKey: string; -} - -export class WebSocketSessionLogonResponseDecoder { - private static readonly BLOCK_LENGTH = 26; - private static readonly TEMPLATE_ID = 51; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): WebSocketSessionLogonResponse { - const view = new DataView(buffer); - let pos = offset; - - const authorizedSince = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const connectedSince = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const returnRateLimits = view.getUint8(pos); - pos += 1; - - const serverTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const userDataStream = view.getUint8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = offset + WebSocketSessionLogonResponseDecoder.BLOCK_LENGTH; - - const loggedOnApiKeyLen = view.getUint16(pos, this.littleEndian); - pos += 2; - const loggedOnApiKey = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, loggedOnApiKeyLen)); - pos += loggedOnApiKeyLen; - - return { - authorizedSince: authorizedSince, - connectedSince: connectedSince, - returnRateLimits: returnRateLimits, - serverTime: serverTime, - userDataStream: userDataStream, - loggedOnApiKey: loggedOnApiKey - }; - } - - static getBlockLength(): number { - return WebSocketSessionLogonResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return WebSocketSessionLogonResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return WebSocketSessionLogonResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return WebSocketSessionLogonResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/WebSocketSessionLogoutResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketSessionLogoutResponse.ts deleted file mode 100644 index f25befade7..0000000000 --- a/binance/generated-typescript/spot_sbe/WebSocketSessionLogoutResponse.ts +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface WebSocketSessionLogoutResponse { - authorizedSince: bigint; - connectedSince: bigint; - returnRateLimits: number; - serverTime: bigint; - userDataStream: number; - loggedOnApiKey: string; -} - -export class WebSocketSessionLogoutResponseDecoder { - private static readonly BLOCK_LENGTH = 26; - private static readonly TEMPLATE_ID = 53; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): WebSocketSessionLogoutResponse { - const view = new DataView(buffer); - let pos = offset; - - const authorizedSince = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const connectedSince = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const returnRateLimits = view.getUint8(pos); - pos += 1; - - const serverTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const userDataStream = view.getUint8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = offset + WebSocketSessionLogoutResponseDecoder.BLOCK_LENGTH; - - const loggedOnApiKeyLen = view.getUint16(pos, this.littleEndian); - pos += 2; - const loggedOnApiKey = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, loggedOnApiKeyLen)); - pos += loggedOnApiKeyLen; - - return { - authorizedSince: authorizedSince, - connectedSince: connectedSince, - returnRateLimits: returnRateLimits, - serverTime: serverTime, - userDataStream: userDataStream, - loggedOnApiKey: loggedOnApiKey - }; - } - - static getBlockLength(): number { - return WebSocketSessionLogoutResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return WebSocketSessionLogoutResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return WebSocketSessionLogoutResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return WebSocketSessionLogoutResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/WebSocketSessionStatusResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketSessionStatusResponse.ts deleted file mode 100644 index bbe6279acf..0000000000 --- a/binance/generated-typescript/spot_sbe/WebSocketSessionStatusResponse.ts +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface WebSocketSessionStatusResponse { - authorizedSince: bigint; - connectedSince: bigint; - returnRateLimits: number; - serverTime: bigint; - userDataStream: number; - loggedOnApiKey: string; -} - -export class WebSocketSessionStatusResponseDecoder { - private static readonly BLOCK_LENGTH = 26; - private static readonly TEMPLATE_ID = 52; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): WebSocketSessionStatusResponse { - const view = new DataView(buffer); - let pos = offset; - - const authorizedSince = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const connectedSince = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const returnRateLimits = view.getUint8(pos); - pos += 1; - - const serverTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - const userDataStream = view.getUint8(pos); - pos += 1; - - // Skip to end of block for forward compatibility - pos = offset + WebSocketSessionStatusResponseDecoder.BLOCK_LENGTH; - - const loggedOnApiKeyLen = view.getUint16(pos, this.littleEndian); - pos += 2; - const loggedOnApiKey = new TextDecoder('utf-8').decode(new Uint8Array(view.buffer, view.byteOffset + pos, loggedOnApiKeyLen)); - pos += loggedOnApiKeyLen; - - return { - authorizedSince: authorizedSince, - connectedSince: connectedSince, - returnRateLimits: returnRateLimits, - serverTime: serverTime, - userDataStream: userDataStream, - loggedOnApiKey: loggedOnApiKey - }; - } - - static getBlockLength(): number { - return WebSocketSessionStatusResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return WebSocketSessionStatusResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return WebSocketSessionStatusResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return WebSocketSessionStatusResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/WebSocketSessionSubscriptionsResponse.ts b/binance/generated-typescript/spot_sbe/WebSocketSessionSubscriptionsResponse.ts deleted file mode 100644 index e81dcd5e31..0000000000 --- a/binance/generated-typescript/spot_sbe/WebSocketSessionSubscriptionsResponse.ts +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Auto-generated by SBE (Simple Binary Encoding) - * Schema: spot_sbe - * DO NOT EDIT - */ - -export interface Subscriptions { - subscriptionId: number; - expirationTime: bigint; -} - -export interface WebSocketSessionSubscriptionsResponse { - subscriptions: Subscriptions[]; -} - -export class WebSocketSessionSubscriptionsResponseDecoder { - private static readonly BLOCK_LENGTH = 0; - private static readonly TEMPLATE_ID = 54; - private static readonly SCHEMA_ID = 3; - private static readonly SCHEMA_VERSION = 2; - - private readonly littleEndian: boolean; - - constructor(byteOrder: 'little' | 'big' = 'little') { - this.littleEndian = byteOrder === 'little'; - } - - decode(buffer: ArrayBuffer, offset: number = 0): WebSocketSessionSubscriptionsResponse { - const view = new DataView(buffer); - let pos = offset; - - // Skip to end of block for forward compatibility - pos = offset + WebSocketSessionSubscriptionsResponseDecoder.BLOCK_LENGTH; - - const subscriptions = this.decodeSubscriptionsGroup(view, pos); - pos = subscriptions.nextOffset; - - return { - subscriptions: subscriptions.items - }; - } - private decodeSubscriptionsGroup(view: DataView, offset: number): { items: Subscriptions[], nextOffset: number } { - let pos = offset; - - const blockLength = view.getUint16(pos, this.littleEndian); - pos += 2; - const numInGroup = view.getUint32(pos, this.littleEndian); - pos += 4; - - const items: Subscriptions[] = []; - - for (let i = 0; i < numInGroup; i++) { - const itemStart = pos; - - const subscriptionId = view.getUint16(pos, this.littleEndian); - pos += 2; - - const expirationTime = view.getBigInt64(pos, this.littleEndian); - pos += 8; - - // Skip to end of block for forward compatibility - pos = itemStart + blockLength; - - items.push({ - subscriptionId: subscriptionId, - expirationTime: expirationTime - }); - } - - return { items, nextOffset: pos }; - } - - static getBlockLength(): number { - return WebSocketSessionSubscriptionsResponseDecoder.BLOCK_LENGTH; - } - - static getTemplateId(): number { - return WebSocketSessionSubscriptionsResponseDecoder.TEMPLATE_ID; - } - - static getSchemaId(): number { - return WebSocketSessionSubscriptionsResponseDecoder.SCHEMA_ID; - } - - static getSchemaVersion(): number { - return WebSocketSessionSubscriptionsResponseDecoder.SCHEMA_VERSION; - } -} diff --git a/binance/generated-typescript/spot_sbe/index.ts b/binance/generated-typescript/spot_sbe/index.ts deleted file mode 100644 index 0cc6b00687..0000000000 --- a/binance/generated-typescript/spot_sbe/index.ts +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Barrel export file for all generated SBE types - * Auto-generated - DO NOT EDIT - */ - -export * from './OrderType'; -export * from './VarString'; -export * from './MatchType'; -export * from './ExecutionType'; -export * from './BoolEnum'; -export * from './OrderStatus'; -export * from './GroupSizeEncoding'; -export * from './PegPriceType'; -export * from './GroupSize16Encoding'; -export * from './OptionalMessageData'; -export * from './ContingencyType'; -export * from './ListOrderStatus'; -export * from './MessageData8'; -export * from './RateLimitInterval'; -export * from './Floor'; -export * from './TimeInForce'; -export * from './ListStatusType'; -export * from './AllowedSelfTradePreventionModes'; -export * from './MessageHeader'; -export * from './AccountType'; -export * from './OptionalMessageData16'; -export * from './OrderCapacity'; -export * from './AllocationType'; -export * from './OptionalVarString'; -export * from './OrderSide'; -export * from './OrderTypes'; -export * from './SelfTradePreventionMode'; -export * from './CancelReplaceStatus'; -export * from './SymbolStatus'; -export * from './OptionalVarString8'; -export * from './RateLimitType'; -export * from './MessageData16'; -export * from './FilterType'; -export * from './PegOffsetType'; -export * from './VarString8'; -export * from './MessageData'; -export * from './MessageHeader'; -export * from './PriceFilter'; -export * from './PercentPriceFilter'; -export * from './PercentPriceBySideFilter'; -export * from './LotSizeFilter'; -export * from './MinNotionalFilter'; -export * from './NotionalFilter'; -export * from './IcebergPartsFilter'; -export * from './MarketLotSizeFilter'; -export * from './MaxNumOrdersFilter'; -export * from './MaxNumAlgoOrdersFilter'; -export * from './MaxNumIcebergOrdersFilter'; -export * from './MaxPositionFilter'; -export * from './TrailingDeltaFilter'; -export * from './TPlusSellFilter'; -export * from './ExchangeMaxNumOrdersFilter'; -export * from './ExchangeMaxNumAlgoOrdersFilter'; -export * from './AccountResponse'; -export * from './ExchangeMaxNumIcebergOrdersFilter'; -export * from './AccountTradesResponse'; -export * from './MaxNumOrderListsFilter'; -export * from './AccountOrderRateLimitResponse'; -export * from './ExchangeMaxNumOrderListsFilter'; -export * from './AccountPreventedMatchesResponse'; -export * from './MaxNumOrderAmendsFilter'; -export * from './AccountAllocationsResponse'; -export * from './MaxAssetFilter'; -export * from './AccountCommissionResponse'; -export * from './NewOrderAckResponse'; -export * from './NewOrderResultResponse'; -export * from './NewOrderFullResponse'; -export * from './OrderTestResponse'; -export * from './OrderResponse'; -export * from './CancelOrderResponse'; -export * from './WebSocketResponse'; -export * from './CancelOpenOrdersResponse'; -export * from './WebSocketSessionLogonResponse'; -export * from './CancelReplaceOrderResponse'; -export * from './WebSocketSessionStatusResponse'; -export * from './OrdersResponse'; -export * from './WebSocketSessionLogoutResponse'; -export * from './NewOrderListAckResponse'; -export * from './WebSocketSessionSubscriptionsResponse'; -export * from './NewOrderListResultResponse'; -export * from './NewOrderListFullResponse'; -export * from './CancelOrderListResponse'; -export * from './OrderListResponse'; -export * from './OrderListsResponse'; -export * from './OrderTestWithCommissionsResponse'; -export * from './OrderAmendmentsResponse'; -export * from './OrderAmendKeepPriorityResponse'; -export * from './DepthResponse'; -export * from './TradesResponse'; -export * from './AggTradesResponse'; -export * from './KlinesResponse'; -export * from './AveragePriceResponse'; -export * from './Ticker24hSymbolFullResponse'; -export * from './Ticker24hFullResponse'; -export * from './Ticker24hSymbolMiniResponse'; -export * from './Ticker24hMiniResponse'; -export * from './PriceTickerSymbolResponse'; -export * from './PriceTickerResponse'; -export * from './BookTickerSymbolResponse'; -export * from './BookTickerResponse'; -export * from './TickerSymbolFullResponse'; -export * from './TickerFullResponse'; -export * from './TickerSymbolMiniResponse'; -export * from './TickerMiniResponse'; -export * from './BalanceUpdateEvent'; -export * from './EventStreamTerminatedEvent'; -export * from './ExecutionReportEvent'; -export * from './ExternalLockUpdateEvent'; -export * from './ListStatusEvent'; -export * from './OutboundAccountPositionEvent'; -export * from './TPlusFilterLockEvent'; -export * from './ErrorResponse'; -export * from './PingResponse'; -export * from './ServerTimeResponse'; -export * from './ExchangeInfoResponse'; -export * from './NonRepresentableMessage'; -export * from './MyFiltersResponse'; -export * from './UserDataStreamStartResponse'; -export * from './UserDataStreamPingResponse'; -export * from './UserDataStreamStopResponse'; -export * from './UserDataStreamSubscribeResponse'; -export * from './UserDataStreamUnsubscribeResponse'; -export * from './UserDataStreamSubscribeListenTokenResponse';