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

28 lines
705 B
JavaScript
Raw Permalink Normal View History

2022-09-05 16:57:11 -04:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NullCoder = void 0;
const abstract_coder_js_1 = require("./abstract-coder.js");
const Empty = new Uint8Array([]);
2022-11-30 15:44:23 -05:00
/**
* @_ignore
*/
2022-09-05 16:57:11 -04:00
class NullCoder extends abstract_coder_js_1.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;
}
}
exports.NullCoder = NullCoder;
//# sourceMappingURL=null.js.map