MCPcopy Create free account
hub / github.com/CPChain/chain / newTransaction

Function newTransaction

types/transaction.go:80–104  ·  view source on GitHub ↗
(nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, txtype uint64)

Source from the content-addressed store, hash-verified

78}
79
80func newTransaction(nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, txtype uint64) *Transaction {
81 if len(data) > 0 {
82 data = common.CopyBytes(data)
83 }
84 d := txdata{
85 Type: txtype,
86 AccountNonce: nonce,
87 Recipient: to,
88 Payload: data,
89 Amount: new(big.Int),
90 GasLimit: gasLimit,
91 Price: new(big.Int),
92 V: new(big.Int),
93 R: new(big.Int),
94 S: new(big.Int),
95 }
96 if amount != nil {
97 d.Amount.Set(amount)
98 }
99 if gasPrice != nil {
100 d.Price.Set(gasPrice)
101 }
102
103 return &Transaction{data: d}
104}
105
106// ChainId returns which chain id this transaction was signed for (if at all)
107func (tx *Transaction) ChainId() *big.Int {

Callers 2

NewTransactionFunction · 0.85
NewContractCreationFunction · 0.85

Calls 1

SetMethod · 0.45

Tested by

no test coverage detected