MCPcopy Index your code
hub / github.com/0xsequence/czip / Encode4Bytes

Method Encode4Bytes

compressor/encode.go:351–360  ·  view source on GitHub ↗
(bytes []byte)

Source from the content-addressed store, hash-verified

349}
350
351func (buf *Buffer) Encode4Bytes(bytes []byte) []byte {
352 // If Bytes4Indexes has this value, then we can just use the index
353 index := buf.Refs.Indexes.Bytes4Indexes[string(bytes)]
354 if index != 0 {
355 return []byte{byte(index)}
356 }
357
358 // If don't then we need to provide it as-is, but it has to be prefixed with 0x00
359 return append([]byte{0x00}, bytes...)
360}
361
362func (buf *Buffer) WriteSequenceNonce(nonce *big.Int, randomNonce bool) (EncodeType, error) {
363 paddedNonce := make([]byte, 32)

Callers 1

WriteBytesOptimizedMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected