diff --git a/airgap/api.go b/airgap/api.go index 31edb85e..d3124134 100644 --- a/airgap/api.go +++ b/airgap/api.go @@ -115,17 +115,14 @@ type FilterQueryParams struct { } type TxMetadata struct { - From common.Address - Nonce uint64 - GasPrice *big.Int - GatewayFeeRecipient *common.Address - GatewayFee *big.Int - FeeCurrency *common.Address - To common.Address - Data []byte - Value *big.Int - Gas uint64 - ChainId *big.Int + From common.Address + Nonce uint64 + GasPrice *big.Int + To common.Address + Data []byte + Value *big.Int + Gas uint64 + ChainId *big.Int } func (tm *TxMetadata) AsCallMessage() ethereum.CallMsg { diff --git a/airgap/server/server.go b/airgap/server/server.go index c7154465..722b6dee 100644 --- a/airgap/server/server.go +++ b/airgap/server/server.go @@ -126,13 +126,11 @@ func (b *airGapServerImpl) ObtainMetadata(ctx context.Context, options *airgap.T } txMetadata := airgap.TxMetadata{ - From: options.From, - Nonce: nonce, - GasPrice: gasPrice, - GatewayFee: nil, - GatewayFeeRecipient: nil, - Value: options.Value, - ChainId: b.chainId, + From: options.From, + Nonce: nonce, + GasPrice: gasPrice, + Value: options.Value, + ChainId: b.chainId, } if options.To != nil { diff --git a/airgap/transaction_marshall.go b/airgap/transaction_marshall.go index 064f88de..abe5a36c 100644 --- a/airgap/transaction_marshall.go +++ b/airgap/transaction_marshall.go @@ -22,26 +22,20 @@ import ( func (tx Transaction) MarshalJSON() ([]byte, error) { var data struct { - From common.Address `json:"from"` - Nonce uint64 `json:"nonce"` - GasPrice *string `json:"gasPrice,omitempty"` - GatewayFeeRecipient *common.Address `json:"gatewayFeeRecipient,omitempty"` - GatewayFee *string `json:"gatewayFee,omitempty"` - FeeCurrency *common.Address `json:"feeCurrency,omitempty"` - To common.Address `json:"to"` - Data string `json:"data"` - Value *string `json:"value,omitempty"` - Gas uint64 `json:"gas"` - ChainId string `json:"chainId"` - Signature string `json:"signature"` + From common.Address `json:"from"` + Nonce uint64 `json:"nonce"` + GasPrice *string `json:"gasPrice,omitempty"` + To common.Address `json:"to"` + Data string `json:"data"` + Value *string `json:"value,omitempty"` + Gas uint64 `json:"gas"` + ChainId string `json:"chainId"` + Signature string `json:"signature"` } data.From = tx.From data.Nonce = tx.Nonce data.GasPrice = bigIntToString(tx.GasPrice) - data.GatewayFeeRecipient = tx.GatewayFeeRecipient - data.GatewayFee = bigIntToString(tx.GatewayFee) - data.FeeCurrency = tx.FeeCurrency data.To = tx.To data.Data = common.Bytes2Hex(tx.Data) data.Value = bigIntToString(tx.Value) @@ -55,18 +49,15 @@ func (tx Transaction) MarshalJSON() ([]byte, error) { func (tx *Transaction) UnmarshalJSON(b []byte) error { var err error var data struct { - From common.Address `json:"from"` - Nonce uint64 `json:"nonce"` - GasPrice *string `json:"gasPrice,omitempty"` - GatewayFeeRecipient *common.Address `json:"gatewayFeeRecipient,omitempty"` - GatewayFee *string `json:"gatewayFee,omitempty"` - FeeCurrency *common.Address `json:"feeCurrency,omitempty"` - To common.Address `json:"to"` - Data string `json:"data"` - Value *string `json:"value,omitempty"` - Gas uint64 `json:"gas"` - ChainId string `json:"chainId"` - Signature string `json:"signature"` + From common.Address `json:"from"` + Nonce uint64 `json:"nonce"` + GasPrice *string `json:"gasPrice,omitempty"` + To common.Address `json:"to"` + Data string `json:"data"` + Value *string `json:"value,omitempty"` + Gas uint64 `json:"gas"` + ChainId string `json:"chainId"` + Signature string `json:"signature"` } if err = json.Unmarshal(b, &data); err != nil { @@ -81,12 +72,6 @@ func (tx *Transaction) UnmarshalJSON(b []byte) error { if err != nil { return err } - tx.GatewayFeeRecipient = data.GatewayFeeRecipient - tx.GatewayFee, err = stringToBigInt(data.GatewayFee) - if err != nil { - return err - } - tx.FeeCurrency = data.FeeCurrency tx.To = data.To tx.Data = common.Hex2Bytes(data.Data) tx.Value, err = stringToBigInt(data.Value) diff --git a/airgap/transaction_marshall_test.go b/airgap/transaction_marshall_test.go index 21a925e7..e535af3e 100644 --- a/airgap/transaction_marshall_test.go +++ b/airgap/transaction_marshall_test.go @@ -25,9 +25,6 @@ import ( func TestTransactionMarshalling(t *testing.T) { RegisterTestingT(t) - address1 := common.HexToAddress("0x11111") - address2 := common.HexToAddress("0x22222") - samples := []struct { name string sample Transaction @@ -36,17 +33,14 @@ func TestTransactionMarshalling(t *testing.T) { name: "Complete", sample: Transaction{ TxMetadata: &TxMetadata{ - From: common.HexToAddress("0x55555"), - Nonce: 70, - GasPrice: big.NewInt(5000), - GatewayFeeRecipient: &address1, - GatewayFee: big.NewInt(5000), - FeeCurrency: &address2, - To: common.HexToAddress("0x33333"), - Data: []byte{1, 2, 3}, - Value: big.NewInt(3000), - Gas: 98, - ChainId: big.NewInt(2000), + From: common.HexToAddress("0x55555"), + Nonce: 70, + GasPrice: big.NewInt(5000), + To: common.HexToAddress("0x33333"), + Data: []byte{1, 2, 3}, + Value: big.NewInt(3000), + Gas: 98, + ChainId: big.NewInt(2000), }, Signature: []byte{1, 2, 3}, }, diff --git a/airgap/txmetadata_marshall.go b/airgap/txmetadata_marshall.go index f0d43ee3..08f1adbc 100644 --- a/airgap/txmetadata_marshall.go +++ b/airgap/txmetadata_marshall.go @@ -22,25 +22,19 @@ import ( func (tm TxMetadata) MarshalJSON() ([]byte, error) { var data struct { - From common.Address `json:"from"` - Nonce uint64 `json:"nonce"` - GasPrice *string `json:"gasPrice,omitempty"` - GatewayFeeRecipient *common.Address `json:"gatewayFeeRecipient,omitempty"` - GatewayFee *string `json:"gatewayFee,omitempty"` - FeeCurrency *common.Address `json:"feeCurrency,omitempty"` - To common.Address `json:"to"` - Data string `json:"data"` - Value *string `json:"value,omitempty"` - Gas uint64 `json:"gas"` - ChainId string `json:"chainId"` + From common.Address `json:"from"` + Nonce uint64 `json:"nonce"` + GasPrice *string `json:"gasPrice,omitempty"` + To common.Address `json:"to"` + Data string `json:"data"` + Value *string `json:"value,omitempty"` + Gas uint64 `json:"gas"` + ChainId string `json:"chainId"` } data.From = tm.From data.Nonce = tm.Nonce data.GasPrice = bigIntToString(tm.GasPrice) - data.GatewayFeeRecipient = tm.GatewayFeeRecipient - data.GatewayFee = bigIntToString(tm.GatewayFee) - data.FeeCurrency = tm.FeeCurrency data.To = tm.To data.Data = common.Bytes2Hex(tm.Data) data.Value = bigIntToString(tm.Value) @@ -53,17 +47,14 @@ func (tm TxMetadata) MarshalJSON() ([]byte, error) { func (tm *TxMetadata) UnmarshalJSON(b []byte) error { var err error var data struct { - From common.Address `json:"from"` - Nonce uint64 `json:"nonce"` - GasPrice *string `json:"gasPrice,omitempty"` - GatewayFeeRecipient *common.Address `json:"gatewayFeeRecipient,omitempty"` - GatewayFee *string `json:"gatewayFee,omitempty"` - FeeCurrency *common.Address `json:"feeCurrency,omitempty"` - To common.Address `json:"to"` - Data string `json:"data"` - Value *string `json:"value,omitempty"` - Gas uint64 `json:"gas"` - ChainId string `json:"chainId"` + From common.Address `json:"from"` + Nonce uint64 `json:"nonce"` + GasPrice *string `json:"gasPrice,omitempty"` + To common.Address `json:"to"` + Data string `json:"data"` + Value *string `json:"value,omitempty"` + Gas uint64 `json:"gas"` + ChainId string `json:"chainId"` } if err = json.Unmarshal(b, &data); err != nil { @@ -76,12 +67,6 @@ func (tm *TxMetadata) UnmarshalJSON(b []byte) error { if err != nil { return err } - tm.GatewayFeeRecipient = data.GatewayFeeRecipient - tm.GatewayFee, err = stringToBigInt(data.GatewayFee) - if err != nil { - return err - } - tm.FeeCurrency = data.FeeCurrency tm.To = data.To tm.Data = common.Hex2Bytes(data.Data) tm.Value, err = stringToBigInt(data.Value) diff --git a/airgap/txmetadata_marshall_test.go b/airgap/txmetadata_marshall_test.go index 30ad4ac0..4f40f0e5 100644 --- a/airgap/txmetadata_marshall_test.go +++ b/airgap/txmetadata_marshall_test.go @@ -25,9 +25,6 @@ import ( func TestTxMetadataMarshalling(t *testing.T) { RegisterTestingT(t) - address1 := common.HexToAddress("0x11111") - address2 := common.HexToAddress("0x22222") - samples := []struct { name string sample TxMetadata @@ -35,17 +32,14 @@ func TestTxMetadataMarshalling(t *testing.T) { { name: "Complete", sample: TxMetadata{ - From: common.HexToAddress("0x55555"), - Nonce: 70, - GasPrice: big.NewInt(5000), - GatewayFeeRecipient: &address1, - GatewayFee: big.NewInt(5000), - FeeCurrency: &address2, - To: common.HexToAddress("0x33333"), - Data: []byte{1, 2, 3}, - Value: big.NewInt(3000), - Gas: 98, - ChainId: big.NewInt(2000), + From: common.HexToAddress("0x55555"), + Nonce: 70, + GasPrice: big.NewInt(5000), + To: common.HexToAddress("0x33333"), + Data: []byte{1, 2, 3}, + Value: big.NewInt(3000), + Gas: 98, + ChainId: big.NewInt(2000), }, }, {