@ckb-lumos/codec
Version:
Make your own molecule binding in JavaScript(TypeScript)
46 lines • 1.82 kB
TypeScript
import { AnyCodec, BytesCodec, BytesLike, FixedBytesCodec, PackParam, UnpackResult } from "./base";
export declare function createFixedHexBytesCodec(byteLength: number): FixedBytesCodec<string, BytesLike>;
/**
* placeholder codec, generally used as a placeholder
* ```
* // for example, when some BytesOpt is not used, it will be filled with this codec
* // option BytesOpt (Bytes);
* const UnusedBytesOpt = UnknownOpt
* ```
*/
export declare const Bytes: BytesCodec<string, BytesLike>;
export declare const BytesOpt: import("./molecule").OptionLayoutCodec<BytesCodec<string, BytesLike>>;
export declare const BytesVec: import("./molecule").ArrayLayoutCodec<BytesCodec<string, BytesLike>>;
export declare const Byte32: FixedBytesCodec<string, BytesLike>;
export declare const Byte32Vec: import("./molecule").ArrayLayoutCodec<FixedBytesCodec<string, BytesLike>>;
export declare function WitnessArgsOf<LockCodec extends AnyCodec, InputTypeCodec extends AnyCodec, OutputTypeCodec extends AnyCodec>(payload: {
lock: LockCodec;
input_type: InputTypeCodec;
output_type: OutputTypeCodec;
}): BytesCodec<{
lock?: UnpackResult<LockCodec>;
input_type?: UnpackResult<InputTypeCodec>;
output_type?: UnpackResult<OutputTypeCodec>;
}, {
lock?: PackParam<LockCodec>;
input_type?: PackParam<InputTypeCodec>;
output_type?: PackParam<OutputTypeCodec>;
}>;
/**
*
* @example
* ```ts
* // secp256k1 lock witness
* WitnessArgs.pack({ lock: '0x' + '00'.repeat(65) })
* ```
*/
export declare const WitnessArgs: BytesCodec<{
lock?: string | undefined;
input_type?: string | undefined;
output_type?: string | undefined;
}, {
lock?: BytesLike | undefined;
input_type?: BytesLike | undefined;
output_type?: BytesLike | undefined;
}>;
//# sourceMappingURL=blockchain.d.ts.map