UNPKG

ccxt

Version:

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

27 lines (24 loc) 822 B
// ---------------------------------------------------------------------------- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code // EDIT THE CORRESPONDENT .ts FILE INSTEAD import { toUtf8Bytes, toUtf8String } from "../utils/utf8.js"; import { Typed } from "../typed.js"; import { DynamicBytesCoder } from "./bytes.js"; /** * @_ignore */ export class StringCoder extends DynamicBytesCoder { constructor(localName) { super("string", localName); } defaultValue() { return ""; } encode(writer, _value) { return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, "string"))); } decode(reader) { return toUtf8String(super.decode(reader)); } }