ethers.js/lib.esm/abi/coders/null.js

24 lines
541 B
JavaScript
Raw Normal View History

2022-09-05 23:57:11 +03:00
import { Coder } from "./abstract-coder.js";
const Empty = new Uint8Array([]);
2022-11-30 23:44:23 +03:00
/**
* @_ignore
*/
2022-09-05 23:57:11 +03:00
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