ethers.js/lib.esm/abi/coders/null.js
2022-11-30 15:44:23 -05:00

24 lines
541 B
JavaScript

import { Coder } from "./abstract-coder.js";
const Empty = new Uint8Array([]);
/**
* @_ignore
*/
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