ethers.js/packages/abi/lib/coders/null.js
2022-04-19 04:50:19 -04:00

21 lines
520 B
JavaScript

import { Coder } from "./abstract-coder.js";
const Empty = new Uint8Array([]);
export class NullCoder extends Coder {
constructor(localName) {
super("null", "", localName, false);
}
defaultValue() {
return null;
}
encode(writer, value) {
if (value != null) {
this._throwError("not null", value);
}
return writer.writeBytes(Empty);
}
decode(reader) {
reader.readBytes(0);
return null;
}
}
//# sourceMappingURL=null.js.map