2019-08-25 09:39:20 +03:00
|
|
|
"use strict";
|
|
|
|
import { toUtf8Bytes, toUtf8String } from "@ethersproject/strings";
|
|
|
|
import { DynamicBytesCoder } from "./bytes";
|
|
|
|
export class StringCoder extends DynamicBytesCoder {
|
|
|
|
constructor(localName) {
|
|
|
|
super("string", localName);
|
|
|
|
}
|
2020-11-23 11:43:28 +03:00
|
|
|
defaultValue() {
|
|
|
|
return "";
|
|
|
|
}
|
2019-08-25 09:39:20 +03:00
|
|
|
encode(writer, value) {
|
|
|
|
return super.encode(writer, toUtf8Bytes(value));
|
|
|
|
}
|
|
|
|
decode(reader) {
|
|
|
|
return toUtf8String(super.decode(reader));
|
|
|
|
}
|
|
|
|
}
|
2020-07-13 15:03:56 +03:00
|
|
|
//# sourceMappingURL=string.js.map
|