@ton3/liteclient
Version:
TON Blockchain LiteClient
31 lines (25 loc) • 799 B
text/typescript
import { StreamWriter } from '../../tl/stream';
import { crc32 } from '../../utils';
import { blockId, BlockId, BlockIdExt, blockIdExt } from '../../dataTypes/tonNode';
export interface LookupBlockInput {
id: BlockId;
lt?: bigint;
utime?: number;
}
export const lookupBlock = (bufferWriter: StreamWriter, input: LookupBlockInput) => {
bufferWriter.writeInt32LE(
crc32(
'liteServer.lookupBlock mode:# id:tonNode.blockId lt:mode.1?long utime:mode.2?int = liteServer.BlockHeader',
),
);
bufferWriter.writeUint32LE(1); // mode
blockId.write(bufferWriter, input.id);
// if (input.lt) {
// bufferWriter.writeInt64LE(input.lt);
// }
//
// if (input.utime) {
// bufferWriter.writeInt32LE(input.utime);
// }
// blockIdExt.write(bufferWriter, blockId);
};