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

Method WriteSequenceTransactions

compressor/encode.go:385–410  ·  view source on GitHub ↗
(txs sequence.Transactions)

Source from the content-addressed store, hash-verified

383}
384
385func (buf *Buffer) WriteSequenceTransactions(txs sequence.Transactions) (EncodeType, error) {
386 if len(txs) == 0 {
387 return Stateless, fmt.Errorf("transactions is empty")
388 }
389
390 if len(txs) > 255 {
391 return Stateless, fmt.Errorf("transactions exceeds 255")
392 }
393
394 // The first byte is the number of transactions
395 buf.commitUint(uint(len(txs)))
396 buf.end([]byte{}, Stateless)
397
398 encodeType := Stateless
399
400 for _, tx := range txs {
401 t, err := buf.WriteSequenceTransaction(tx)
402 if err != nil {
403 return Stateless, err
404 }
405
406 encodeType = maxPriority(encodeType, t)
407 }
408
409 return encodeType, nil
410}
411
412func (buf *Buffer) WriteSequenceTransaction(tx *sequence.Transaction) (EncodeType, error) {
413 // The first byte is the flag of the transaction, the specification follows:

Callers 2

WriteSequenceExecuteMethod · 0.95

Calls 4

commitUintMethod · 0.95
endMethod · 0.95
maxPriorityFunction · 0.85

Tested by

no test coverage detected