github.com/sixexorg/magnetic-ring@v0.0.0-20191119090307-31705a21e419/common/types.go (about)

     1  package common
     2  
     3  import (
     4  	"math/big"
     5  	"reflect"
     6  )
     7  
     8  type Arguments []*Argument
     9  
    10  type Argument struct {
    11  	Name     string
    12  	Type     reflect.Type
    13  	Required bool
    14  	HashOut  bool
    15  }
    16  
    17  func (s Arguments) Len() int           { return len(s) }
    18  func (s Arguments) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
    19  func (s Arguments) Less(i, j int) bool { return s[i].Name < s[j].Name }
    20  
    21  var (
    22  	BType_TxIns       = reflect.TypeOf(TxIns{})
    23  	BType_TxOuts      = reflect.TypeOf(TxOuts{})
    24  	BType_Address     = reflect.TypeOf(Address{})
    25  	BType_Symbol      = reflect.TypeOf(Symbol{})
    26  	BType_Hash        = reflect.TypeOf(Hash{})
    27  	BType_TxHashArray = reflect.TypeOf(HashArray{})
    28  	BType_SigBuf      = reflect.TypeOf(SigBuf{})
    29  	BType_BigInt      = reflect.TypeOf(big.NewInt(0))
    30  	BType_Uint8       = reflect.TypeOf(uint8(0))
    31  	BType_Uint16      = reflect.TypeOf(uint16(0))
    32  	BType_Uint32      = reflect.TypeOf(uint32(0))
    33  	BType_Uint64      = reflect.TypeOf(uint64(0))
    34  	BType_Bool        = reflect.TypeOf(true)
    35  	BType_Bytes       = reflect.TypeOf([]byte{})
    36  )
    37  
    38  type TxOut struct {
    39  	Address Address
    40  	Amount  *big.Int
    41  }
    42  
    43  //rlp can't type TxAmounts []*TxAmount
    44  type TxOuts struct {
    45  	Tos []*TxOut
    46  }
    47  
    48  type TxIn struct {
    49  	Address Address
    50  	Amount  *big.Int
    51  	Nonce   uint64
    52  }
    53  type TxIns struct {
    54  	Tis []*TxIn
    55  }