MCPcopy Create free account
hub / github.com/0xsequence/czip / WriteSequenceNonce

Method WriteSequenceNonce

compressor/encode.go:362–383  ·  view source on GitHub ↗
(nonce *big.Int, randomNonce bool)

Source from the content-addressed store, hash-verified

360}
361
362func (buf *Buffer) WriteSequenceNonce(nonce *big.Int, randomNonce bool) (EncodeType, error) {
363 paddedNonce := make([]byte, 32)
364 copy(paddedNonce[32-len(nonce.Bytes()):], nonce.Bytes())
365
366 // The nonce is encoded in two parts, the first 160 bits are the space
367 // the last 96 bits are the nonce itself, the nonce space can be saved to storage
368 // unless it is a random nonce
369 spaceBytes := paddedNonce[:20]
370 nonceBytes := paddedNonce[20:]
371
372 t1, err := buf.WriteWord(spaceBytes, !randomNonce)
373 if err != nil {
374 return Stateless, err
375 }
376
377 t2, err := buf.WriteWord(nonceBytes, false)
378 if err != nil {
379 return Stateless, err
380 }
381
382 return maxPriority(t1, t2), nil
383}
384
385func (buf *Buffer) WriteSequenceTransactions(txs sequence.Transactions) (EncodeType, error) {
386 if len(txs) == 0 {

Callers 1

WriteSequenceExecuteMethod · 0.95

Calls 2

WriteWordMethod · 0.95
maxPriorityFunction · 0.85

Tested by

no test coverage detected