ethers.js/packages/abi/lib.esm/coders/boolean.js

17 lines
449 B
JavaScript
Raw Permalink Normal View History

"use strict";
import { Coder } from "./abstract-coder";
export class BooleanCoder extends Coder {
constructor(localName) {
super("bool", "bool", localName, false);
}
2020-11-23 03:43:28 -05:00
defaultValue() {
return false;
}
encode(writer, value) {
return writer.writeValue(value ? 1 : 0);
}
decode(reader) {
return reader.coerce(this.type, !reader.readValue().isZero());
}
}
2020-07-13 08:03:56 -04:00
//# sourceMappingURL=boolean.js.map