|
|
@@ -112,6 +112,7 @@ func (tx *Transaction) encodeTyped(w *bytes.Buffer) error {
|
|
|
// For legacy transactions, it returns the RLP encoding. For EIP-2718 typed
|
|
|
// transactions, it returns the type and payload.
|
|
|
func (tx *Transaction) MarshalBinary() ([]byte, error) {
|
|
|
+
|
|
|
if tx.Type() == LegacyTxType {
|
|
|
return rlp.EncodeToBytes(tx.inner)
|
|
|
}
|
|
|
@@ -241,6 +242,28 @@ func (tx *Transaction) Protected() bool {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 返回inner所有数据
|
|
|
+
|
|
|
+func (tx *Transaction) GetInner() TxData {
|
|
|
+ return tx.inner
|
|
|
+}
|
|
|
+
|
|
|
+func (tx *Transaction) Inner() (byte, TxData, *big.Int, AccessList, []byte, uint64, *big.Int, *big.Int, uint64, *common.Address, *big.Int, *big.Int, *big.Int) {
|
|
|
+ txType := tx.inner.txType()
|
|
|
+ copiedTxData := tx.inner.copy()
|
|
|
+ chainID := tx.inner.chainID()
|
|
|
+ accessList := tx.inner.accessList()
|
|
|
+ data := tx.inner.data()
|
|
|
+ gas := tx.inner.gas()
|
|
|
+ gasPrice := tx.inner.gasPrice()
|
|
|
+ value := tx.inner.value()
|
|
|
+ nonce := tx.inner.nonce()
|
|
|
+ to := tx.inner.to()
|
|
|
+ v, r, s := tx.inner.rawSignatureValues()
|
|
|
+
|
|
|
+ return txType, copiedTxData, chainID, accessList, data, gas, gasPrice, value, nonce, to, v, r, s
|
|
|
+}
|
|
|
+
|
|
|
// Type returns the transaction type.
|
|
|
func (tx *Transaction) Type() uint8 {
|
|
|
return tx.inner.txType()
|