0xweb
Version:
Contract package manager and other web3 tools
30 lines (23 loc) • 660 B
text/typescript
import { Coder } from "./abstract-coder";
import type { Reader, Writer } from "./abstract-coder";
/**
* Clones the functionality of an existing Coder, but without a localName
*
* @_ignore
*/
export class AnonymousCoder extends Coder {
private coder: Coder;
constructor(coder: Coder) {
super(coder.name, coder.type, "_", coder.dynamic);
this.coder = coder;
}
defaultValue(): any {
return this.coder.defaultValue();
}
encode(writer: Writer, value: any): number {
return this.coder.encode(writer, value);
}
decode(reader: Reader): any {
return this.coder.decode(reader);
}
}