From 773292ef78396d960b0e224dfb5b53d9e2d694c6 Mon Sep 17 00:00:00 2001 From: Tamir Sen Date: Fri, 11 Oct 2019 09:37:03 +0300 Subject: [PATCH 1/2] Remove deprecated fee_paid field from Transaction --- clients/horizon/main_test.go | 12 +++++--- clients/horizonclient/main_test.go | 12 +++++--- .../horizonclient/transaction_request_test.go | 8 ++++-- protocols/horizon/main.go | 28 ++++++++----------- protocols/horizon/main_test.go | 9 +++--- services/horizon/CHANGELOG.md | 4 +++ .../reference/endpoints/transactions-all.md | 8 +++--- .../endpoints/transactions-for-ledger.md | 9 ++++-- .../endpoints/transactions-single.md | 3 +- .../docs/reference/resources/transaction.md | 6 ++-- .../resourceadapter/operations_test.go | 3 +- .../internal/resourceadapter/transaction.go | 1 - .../resourceadapter/transaction_test.go | 3 +- 13 files changed, 62 insertions(+), 44 deletions(-) diff --git a/clients/horizon/main_test.go b/clients/horizon/main_test.go index 71514ec72b..ab6d834cab 100644 --- a/clients/horizon/main_test.go +++ b/clients/horizon/main_test.go @@ -311,7 +311,8 @@ func TestLoadTransaction(t *testing.T) { assert.Equal(t, transaction.Hash, "a4ca51d09610154409890763e2c8ecbaa36688c957dea1df0578bdbc1f65d312") assert.Equal(t, transaction.Ledger, int32(17425656)) assert.Equal(t, transaction.Account, "GBQ352ACDO6DEGI42SOI4DCB654N7B7DANO4RSBGA5CZLM4475CQNID4") - assert.Equal(t, transaction.FeePaid, int32(100)) + assert.Equal(t, transaction.FeeCharged, int32(100)) + assert.Equal(t, transaction.MaxFee, int32(100)) assert.Equal(t, transaction.ResultXdr, "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=") } @@ -798,7 +799,8 @@ var accountTransactionsResponse = `{ "created_at": "2018-10-31T16:04:26Z", "source_account": "GCK6ALX65S5KTQRKX3OWG5DNCJ7XMI62N55TKRM6ZI2YNWDSO3PX3YSZ", "source_account_sequence": "1901476511219733", - "fee_paid": 100, + "fee_charged": 100, + "max_fee": 100, "operation_count": 1, "envelope_xdr": "AAAAAJXgLv7suqnCKr7dY3RtEn92I9pvezVFnso1hthydt99AAAAZAAGwWIAAAAVAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAdTglQu8gT30RQIRX++/4DfJexNtwt8lsgFB6o72b7ogAAAACV1dNTlBQUUlNR0VHAAAAAHU4JULvIE99EUCEV/vv+A3yXsTbcLfJbIBQeqO9m+6IAAAAAACYloAAAAAAAAAAAXZU+JIAAABAvVrpeUdGqVv4rOJk5C0LPLvFKgVPwKtKtSEtz2jQUN0H3fiUHqmK7VtjwgC7Bvj7WfDponOHGsgbzjStlMDPBA==", "result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAA=", @@ -842,7 +844,8 @@ var accountTransactionsResponse = `{ "created_at": "2018-10-31T16:04:17Z", "source_account": "GCK6ALX65S5KTQRKX3OWG5DNCJ7XMI62N55TKRM6ZI2YNWDSO3PX3YSZ", "source_account_sequence": "1901476511219732", - "fee_paid": 100, + "fee_charged": 100, + "max_fee": 100, "operation_count": 1, "envelope_xdr": "AAAAAJXgLv7suqnCKr7dY3RtEn92I9pvezVFnso1hthydt99AAAAZAAGwWIAAAAUAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAdTglQu8gT30RQIRX++/4DfJexNtwt8lsgFB6o72b7ogAAAACV1dNTlBQUUlNR0VHAAAAAHU4JULvIE99EUCEV/vv+A3yXsTbcLfJbIBQeqO9m+6IAAAAAACYloAAAAAAAAAAAXZU+JIAAABA1gQZebvgMe8B16XZgoBjhUHFxEKobB7O2agfS1Az3BhangQ/qfHKB1QgUo3ypIMpmsX6k8KdVGPWkrGNmv+DCg==", "result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAA=", @@ -890,7 +893,8 @@ var transactionResponse = `{ "created_at": "2018-04-19T00:16:25Z", "source_account": "GBQ352ACDO6DEGI42SOI4DCB654N7B7DANO4RSBGA5CZLM4475CQNID4", "source_account_sequence": "74842446537687041", - "fee_paid": 100, + "fee_charged": 100, + "max_fee": 100, "operation_count": 1, "envelope_xdr": "AAAAAGG+6AIbvDIZHNScjgxB93jfh+MDXcjIJgdFlbOc/0UGAAAAZAEJ5M8AAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAWItna6Yfm4mu3aBouY6Jkq/sVMZZmYKp+Ybebu74C4YAAAAAAJiWgAAAAAAAAAABnP9FBgAAAEB/ufrWJGD1YeVvoxoku9U6CWQTUIO9SGf7NnbZY50Tn7+pNOtNslZy0bYlAabSgoCfJ2ZXRmDMue9v9nrFsLEA", "result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=", diff --git a/clients/horizonclient/main_test.go b/clients/horizonclient/main_test.go index 2f0b4f8a82..4fb4a211e7 100644 --- a/clients/horizonclient/main_test.go +++ b/clients/horizonclient/main_test.go @@ -929,7 +929,8 @@ func TestTransactionsRequest(t *testing.T) { assert.IsType(t, tx, hProtocol.Transaction{}) assert.Equal(t, tx.ID, "3274f131af56ecb6d8668acf6eb0b31b5f8faeca785cbce0a911a5a81308a599") assert.Equal(t, tx.Ledger, int32(438134)) - assert.Equal(t, tx.FeePaid, int32(100)) + assert.Equal(t, tx.FeeCharged, int32(100)) + assert.Equal(t, tx.MaxFee, int32(100)) assert.Equal(t, tx.Hash, "3274f131af56ecb6d8668acf6eb0b31b5f8faeca785cbce0a911a5a81308a599") } @@ -1756,7 +1757,8 @@ var txPageResponse = `{ "created_at": "2019-03-25T10:27:53Z", "source_account": "GAIH3ULLFQ4DGSECF2AR555KZ4KNDGEKN4AFI4SU2M7B43MGK3QJZNSR", "source_account_sequence": "4660039787356", - "fee_paid": 100, + "fee_charged": 100, + "max_fee": 100, "operation_count": 1, "envelope_xdr": "AAAAABB90WssODNIgi6BHveqzxTRmIpvAFRyVNM+Hm2GVuCcAAAAZAAABD0ABCNcAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAzvbakxhsAWYE0gRDf2pfXaYUCnH8vEwyQiNOJYLmNRIAAAAXSHboAAAAAAAAAAABhlbgnAAAAEBw2qecm0C4q7xi8+43NjuExfspCtA1ki2Jq2lWuNSLArJ0qcOhz/HnszFppaCBHkFf/37557MbF4NbFZXlVv4P", "result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=", @@ -1802,7 +1804,8 @@ var txPageResponse = `{ "created_at": "2019-03-25T10:27:53Z", "source_account": "GC3IMK2BSHNZZ4WAC3AXQYA7HQTZKUUDJ7UYSA2HTNCIX5S5A5NVD3FD", "source_account_sequence": "1881766906298369", - "fee_paid": 100, + "fee_charged": 100, + "max_fee": 100, "operation_count": 1, "envelope_xdr": "AAAAALaGK0GR25zywBbBeGAfPCeVUoNP6YkDR5tEi/ZdB1tRAAAAZAAGr3UAAAABAAAAAAAAAAEAAAAQMkExVjZKNTcwM0c0N1hIWQAAAAEAAAABAAAAALaGK0GR25zywBbBeGAfPCeVUoNP6YkDR5tEi/ZdB1tRAAAAAQAAAADMSEvcRKXsaUNna++Hy7gWm/CfqTjEA7xoGypfrFGUHAAAAAAAAAACBo93AAAAAAAAAAABXQdbUQAAAECQ5m6ZHsv8/Gd/aRJ2EMLurJMxFynT7KbD51T7gD91Gqp/fzsRHilSGoVSw5ztmtJb2LP7o3bQbiZynQiJPl8C", "result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAA=", @@ -1852,7 +1855,8 @@ var txDetailResponse = `{ "created_at": "2019-03-25T10:27:53Z", "source_account": "GC3IMK2BSHNZZ4WAC3AXQYA7HQTZKUUDJ7UYSA2HTNCIX5S5A5NVD3FD", "source_account_sequence": "1881766906298369", - "fee_paid": 100, + "fee_charged": 100, + "max_fee": 100, "operation_count": 1, "envelope_xdr": "AAAAALaGK0GR25zywBbBeGAfPCeVUoNP6YkDR5tEi/ZdB1tRAAAAZAAGr3UAAAABAAAAAAAAAAEAAAAQMkExVjZKNTcwM0c0N1hIWQAAAAEAAAABAAAAALaGK0GR25zywBbBeGAfPCeVUoNP6YkDR5tEi/ZdB1tRAAAAAQAAAADMSEvcRKXsaUNna++Hy7gWm/CfqTjEA7xoGypfrFGUHAAAAAAAAAACBo93AAAAAAAAAAABXQdbUQAAAECQ5m6ZHsv8/Gd/aRJ2EMLurJMxFynT7KbD51T7gD91Gqp/fzsRHilSGoVSw5ztmtJb2LP7o3bQbiZynQiJPl8C", "result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAA=", diff --git a/clients/horizonclient/transaction_request_test.go b/clients/horizonclient/transaction_request_test.go index ddae75bda0..7ab70e6e25 100644 --- a/clients/horizonclient/transaction_request_test.go +++ b/clients/horizonclient/transaction_request_test.go @@ -243,7 +243,7 @@ func TestTransactionRequestStreamTransactions(t *testing.T) { } } -var txStreamResponse = `data: {"_links":{"self":{"href":"https://horizon-testnet.stellar.org/transactions/1534f6507420c6871b557cc2fc800c29fb1ed1e012e694993ffe7a39c824056e"},"account":{"href":"https://horizon-testnet.stellar.org/accounts/GAIH3ULLFQ4DGSECF2AR555KZ4KNDGEKN4AFI4SU2M7B43MGK3QJZNSR"},"ledger":{"href":"https://horizon-testnet.stellar.org/ledgers/607387"},"operations":{"href":"https://horizon-testnet.stellar.org/transactions/1534f6507420c6871b557cc2fc800c29fb1ed1e012e694993ffe7a39c824056e/operations{?cursor,limit,order}","templated":true},"effects":{"href":"https://horizon-testnet.stellar.org/transactions/1534f6507420c6871b557cc2fc800c29fb1ed1e012e694993ffe7a39c824056e/effects{?cursor,limit,order}","templated":true},"precedes":{"href":"https://horizon-testnet.stellar.org/transactions?order=asc\u0026cursor=2608707301036032"},"succeeds":{"href":"https://horizon-testnet.stellar.org/transactions?order=desc\u0026cursor=2608707301036032"}},"id":"1534f6507420c6871b557cc2fc800c29fb1ed1e012e694993ffe7a39c824056e","paging_token":"2608707301036032","successful":true,"hash":"1534f6507420c6871b557cc2fc800c29fb1ed1e012e694993ffe7a39c824056e","ledger":607387,"created_at":"2019-04-04T12:07:03Z","source_account":"GAIH3ULLFQ4DGSECF2AR555KZ4KNDGEKN4AFI4SU2M7B43MGK3QJZNSR","source_account_sequence":"4660039930473","fee_paid":100,"operation_count":1,"envelope_xdr":"AAAAABB90WssODNIgi6BHveqzxTRmIpvAFRyVNM+Hm2GVuCcAAAAZAAABD0ABlJpAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAmLuzasXDMqsqgFK4xkbLxJLzmQQzkiCF2SnKPD+b1TsAAAAXSHboAAAAAAAAAAABhlbgnAAAAECqxhXduvtzs65keKuTzMtk76cts2WeVB2pZKYdlxlOb1EIbOpFhYizDSXVfQlAvvg18qV6oNRr7ls4nnEm2YIK","result_xdr":"AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=","result_meta_xdr":"AAAAAQAAAAIAAAADAAlEmwAAAAAAAAAAEH3Rayw4M0iCLoEe96rPFNGYim8AVHJU0z4ebYZW4JwBT3aiixBA2AAABD0ABlJoAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAlEmwAAAAAAAAAAEH3Rayw4M0iCLoEe96rPFNGYim8AVHJU0z4ebYZW4JwBT3aiixBA2AAABD0ABlJpAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAMACUSbAAAAAAAAAAAQfdFrLDgzSIIugR73qs8U0ZiKbwBUclTTPh5thlbgnAFPdqKLEEDYAAAEPQAGUmkAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEACUSbAAAAAAAAAAAQfdFrLDgzSIIugR73qs8U0ZiKbwBUclTTPh5thlbgnAFPdotCmVjYAAAEPQAGUmkAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAACUSbAAAAAAAAAACYu7NqxcMyqyqAUrjGRsvEkvOZBDOSIIXZKco8P5vVOwAAABdIdugAAAlEmwAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==","fee_meta_xdr":"AAAAAgAAAAMACUSaAAAAAAAAAAAQfdFrLDgzSIIugR73qs8U0ZiKbwBUclTTPh5thlbgnAFPdqKLEEE8AAAEPQAGUmgAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEACUSbAAAAAAAAAAAQfdFrLDgzSIIugR73qs8U0ZiKbwBUclTTPh5thlbgnAFPdqKLEEDYAAAEPQAGUmgAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==","memo_type":"none","signatures":["qsYV3br7c7OuZHirk8zLZO+nLbNlnlQdqWSmHZcZTm9RCGzqRYWIsw0l1X0JQL74NfKleqDUa+5bOJ5xJtmCCg=="]} +var txStreamResponse = `data: {"_links":{"self":{"href":"https://horizon-testnet.stellar.org/transactions/1534f6507420c6871b557cc2fc800c29fb1ed1e012e694993ffe7a39c824056e"},"account":{"href":"https://horizon-testnet.stellar.org/accounts/GAIH3ULLFQ4DGSECF2AR555KZ4KNDGEKN4AFI4SU2M7B43MGK3QJZNSR"},"ledger":{"href":"https://horizon-testnet.stellar.org/ledgers/607387"},"operations":{"href":"https://horizon-testnet.stellar.org/transactions/1534f6507420c6871b557cc2fc800c29fb1ed1e012e694993ffe7a39c824056e/operations{?cursor,limit,order}","templated":true},"effects":{"href":"https://horizon-testnet.stellar.org/transactions/1534f6507420c6871b557cc2fc800c29fb1ed1e012e694993ffe7a39c824056e/effects{?cursor,limit,order}","templated":true},"precedes":{"href":"https://horizon-testnet.stellar.org/transactions?order=asc\u0026cursor=2608707301036032"},"succeeds":{"href":"https://horizon-testnet.stellar.org/transactions?order=desc\u0026cursor=2608707301036032"}},"id":"1534f6507420c6871b557cc2fc800c29fb1ed1e012e694993ffe7a39c824056e","paging_token":"2608707301036032","successful":true,"hash":"1534f6507420c6871b557cc2fc800c29fb1ed1e012e694993ffe7a39c824056e","ledger":607387,"created_at":"2019-04-04T12:07:03Z","source_account":"GAIH3ULLFQ4DGSECF2AR555KZ4KNDGEKN4AFI4SU2M7B43MGK3QJZNSR","source_account_sequence":"4660039930473","max_fee":100,"fee_charged":100,"operation_count":1,"envelope_xdr":"AAAAABB90WssODNIgi6BHveqzxTRmIpvAFRyVNM+Hm2GVuCcAAAAZAAABD0ABlJpAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAmLuzasXDMqsqgFK4xkbLxJLzmQQzkiCF2SnKPD+b1TsAAAAXSHboAAAAAAAAAAABhlbgnAAAAECqxhXduvtzs65keKuTzMtk76cts2WeVB2pZKYdlxlOb1EIbOpFhYizDSXVfQlAvvg18qV6oNRr7ls4nnEm2YIK","result_xdr":"AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=","result_meta_xdr":"AAAAAQAAAAIAAAADAAlEmwAAAAAAAAAAEH3Rayw4M0iCLoEe96rPFNGYim8AVHJU0z4ebYZW4JwBT3aiixBA2AAABD0ABlJoAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAlEmwAAAAAAAAAAEH3Rayw4M0iCLoEe96rPFNGYim8AVHJU0z4ebYZW4JwBT3aiixBA2AAABD0ABlJpAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAMACUSbAAAAAAAAAAAQfdFrLDgzSIIugR73qs8U0ZiKbwBUclTTPh5thlbgnAFPdqKLEEDYAAAEPQAGUmkAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEACUSbAAAAAAAAAAAQfdFrLDgzSIIugR73qs8U0ZiKbwBUclTTPh5thlbgnAFPdotCmVjYAAAEPQAGUmkAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAACUSbAAAAAAAAAACYu7NqxcMyqyqAUrjGRsvEkvOZBDOSIIXZKco8P5vVOwAAABdIdugAAAlEmwAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==","fee_meta_xdr":"AAAAAgAAAAMACUSaAAAAAAAAAAAQfdFrLDgzSIIugR73qs8U0ZiKbwBUclTTPh5thlbgnAFPdqKLEEE8AAAEPQAGUmgAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEACUSbAAAAAAAAAAAQfdFrLDgzSIIugR73qs8U0ZiKbwBUclTTPh5thlbgnAFPdqKLEEDYAAAEPQAGUmgAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==","memo_type":"none","signatures":["qsYV3br7c7OuZHirk8zLZO+nLbNlnlQdqWSmHZcZTm9RCGzqRYWIsw0l1X0JQL74NfKleqDUa+5bOJ5xJtmCCg=="]} ` var firstTransactionsPage = `{ @@ -295,7 +295,8 @@ var firstTransactionsPage = `{ "created_at": "2019-05-16T10:17:44Z", "source_account": "GDRZVYB5QI6UFR4NR4RXQ3HR5IH4KL2ECR4IUZXGHOUMPGLN2OGCSAOK", "source_account_sequence": "1566048155336705", - "fee_paid": 100, + "max_fee": 100, + "fee_charged":100, "operation_count": 1, "envelope_xdr": "AAAAAOOa4D2CPULHjY8jeGzx6g/FL0QUeIpm5juox5lt04wpAAAAZAAFkFAAAAABAAAAAAAAAAEAAAAKMzIzMjA5NjQ2NQAAAAAAAQAAAAEAAAAA45rgPYI9QseNjyN4bPHqD8UvRBR4imbmO6jHmW3TjCkAAAABAAAAAE3j7m7lhZ39noA3ToXWDjJ9QuMmmp/1UaIg0chYzRSlAAAAAAAAAAJMTD+AAAAAAAAAAAFt04wpAAAAQAxFRWcepbQoisfiZ0PG7XhPIBl2ssiD9ymMVpsDyLoHyWXboJLaqibNbiPUHk/KEToTVg7G/JCZ06Mfj0daVAc=", "result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAA=", @@ -340,7 +341,8 @@ var firstTransactionsPage = `{ "created_at": "2019-05-16T10:17:44Z", "source_account": "GCYN7MI6VXVRP74KR6MKBAW2ELLCXL6QCY5H4YQ62HVWZWMCE6Y232UC", "source_account_sequence": "132761734108361", - "fee_paid": 5000, + "max_fee": 100, + "fee_charged":100, "operation_count": 50, "envelope_xdr": "AAAAALDfsR6t6xf/io...", "result_xdr": "AAAAALDfsR6t6xf/io...", diff --git a/protocols/horizon/main.go b/protocols/horizon/main.go index cb80e4c899..687fffb5e3 100644 --- a/protocols/horizon/main.go +++ b/protocols/horizon/main.go @@ -417,22 +417,18 @@ type Transaction struct { LedgerCloseTime time.Time `json:"created_at"` Account string `json:"source_account"` AccountSequence string `json:"source_account_sequence"` - // Action needed in release: horizon-v0.23.0 - // Action needed in release: horizonclient-v2.0.0 - // Remove this field. - FeePaid int32 `json:"fee_paid"` - FeeCharged int32 `json:"fee_charged"` - MaxFee int32 `json:"max_fee"` - OperationCount int32 `json:"operation_count"` - EnvelopeXdr string `json:"envelope_xdr"` - ResultXdr string `json:"result_xdr"` - ResultMetaXdr string `json:"result_meta_xdr"` - FeeMetaXdr string `json:"fee_meta_xdr"` - MemoType string `json:"memo_type"` - Memo string `json:"memo,omitempty"` - Signatures []string `json:"signatures"` - ValidAfter string `json:"valid_after,omitempty"` - ValidBefore string `json:"valid_before,omitempty"` + FeeCharged int32 `json:"fee_charged"` + MaxFee int32 `json:"max_fee"` + OperationCount int32 `json:"operation_count"` + EnvelopeXdr string `json:"envelope_xdr"` + ResultXdr string `json:"result_xdr"` + ResultMetaXdr string `json:"result_meta_xdr"` + FeeMetaXdr string `json:"fee_meta_xdr"` + MemoType string `json:"memo_type"` + Memo string `json:"memo,omitempty"` + Signatures []string `json:"signatures"` + ValidAfter string `json:"valid_after,omitempty"` + ValidBefore string `json:"valid_before,omitempty"` } // MarshalJSON implements a custom marshaler for Transaction. diff --git a/protocols/horizon/main_test.go b/protocols/horizon/main_test.go index ae4707735f..688d579af5 100644 --- a/protocols/horizon/main_test.go +++ b/protocols/horizon/main_test.go @@ -52,10 +52,11 @@ func TestAccount_MustGetData(t *testing.T) { // Transaction Tests func TestTransactionJSONMarshal(t *testing.T) { transaction := Transaction{ - ID: "12345", - FeePaid: 10, - MemoType: "text", - Memo: "", + ID: "12345", + MaxFee: 11, + FeeCharged: 10, + MemoType: "text", + Memo: "", } marshaledTransaction, marshalErr := json.Marshal(transaction) assert.Nil(t, marshalErr) diff --git a/services/horizon/CHANGELOG.md b/services/horizon/CHANGELOG.md index 85b9fd9024..06e9acd526 100644 --- a/services/horizon/CHANGELOG.md +++ b/services/horizon/CHANGELOG.md @@ -6,6 +6,10 @@ file. This project adheres to [Semantic Versioning](http://semver.org/). As this project is pre 1.0, breaking changes may happen for minor version bumps. A breaking change will get clearly notified in this log. +## v0.23.0 + +* Remove deprecated `fee_paid` field on Transaction resource. Please use new fields added in 0.18.0: `max_fee` that defines the maximum fee the source account is willing to pay and `fee_charged` that defines the fee that was actually paid for a transaction. See [CAP-0005](https://github.com/stellar/stellar-protocol/blob/master/core/cap-0005.md) for more information. + ## v0.22.1 * Fixes a bug in path payment ingestion code. diff --git a/services/horizon/internal/docs/reference/endpoints/transactions-all.md b/services/horizon/internal/docs/reference/endpoints/transactions-all.md index 81f6bd8bea..0af6e27354 100644 --- a/services/horizon/internal/docs/reference/endpoints/transactions-all.md +++ b/services/horizon/internal/docs/reference/endpoints/transactions-all.md @@ -119,8 +119,8 @@ See [transaction resource](../resources/transaction.md) for reference. "created_at": "2015-09-24T10:07:09Z", "account": "GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K", "account_sequence": 279172874343, - "max_fee": 0, - "fee_paid": 0, + "max_fee": 100, + "fee_charged": 100, "operation_count": 1, "envelope_xdr": "AAAAAGXNhLrhGtltTwCpmqlarh7s1DB2hIkbP//jgzn4Fos/AAAACgAAAEEAAABnAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAA2ddmTOFAgr21Crs2RXRGLhiAKxicZb/IERyEZL/Y2kUAAAAXSHboAAAAAAAAAAAB+BaLPwAAAECDEEZmzbgBr5fc3mfJsCjWPDtL6H8/vf16me121CC09ONyWJZnw0PUvp4qusmRwC6ZKfLDdk8F3Rq41s+yOgQD", "result_xdr": "AAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=", @@ -160,8 +160,8 @@ See [transaction resource](../resources/transaction.md) for reference. "created_at": "2015-09-24T07:49:38Z", "account": "GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K", "account_sequence": 279172874342, - "max_fee": 0, - "fee_paid": 0, + "max_fee": 100, + "fee_charged": 100, "operation_count": 1, "envelope_xdr": "AAAAAGXNhLrhGtltTwCpmqlarh7s1DB2hIkbP//jgzn4Fos/AAAACgAAAEEAAABmAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAMPT7P7buwqnMueFS4NV10vE2q3C/mcAy4jx03/RdSGsAAAAXSHboAAAAAAAAAAAB+BaLPwAAAEBPWWMNSWyPBbQlhRheXyvAFDVx1rnf68fdDOUHPdDIkHdUczBpzvCjpdgwhQ2NYOX5ga1ZgOIWLy789YNnuIcL", "result_xdr": "AAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=", diff --git a/services/horizon/internal/docs/reference/endpoints/transactions-for-ledger.md b/services/horizon/internal/docs/reference/endpoints/transactions-for-ledger.md index bf255cf25a..eea110a8b7 100644 --- a/services/horizon/internal/docs/reference/endpoints/transactions-for-ledger.md +++ b/services/horizon/internal/docs/reference/endpoints/transactions-for-ledger.md @@ -102,7 +102,8 @@ resource](../resources/transaction.md) for reference. "created_at": "2019-04-09T20:14:25Z", "source_account": "GAIH3ULLFQ4DGSECF2AR555KZ4KNDGEKN4AFI4SU2M7B43MGK3QJZNSR", "source_account_sequence": "4660039994869", - "fee_paid": 100, + "fee_charged": 100, + "max_fee": 100, "operation_count": 1, "envelope_xdr": "AAAAABB90WssODNIgi6BHveqzxTRmIpvAFRyVNM+Hm2GVuCcAAAAZAAABD0AB031AAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAFIMRkFZ9gZifhRSlklQpsz/9P04Earv0dzS3MkIM1cYAAAAXSHboAAAAAAAAAAABhlbgnAAAAEA+biIjrDy8yi+SvhFElIdWGBRYlDscnSSHkPchePy2JYDJn4wvJYDBumXI7/NmttUey3+cGWbBFfnnWh1H5EoD", "result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=", @@ -148,7 +149,8 @@ resource](../resources/transaction.md) for reference. "created_at": "2019-04-09T20:14:25Z", "source_account": "GAZ4A54KE6MTMXYEPM7T3IDLZWGNCCKB5ME422NZ3MAMTHWWP37RPEBW", "source_account_sequence": "2994107601387521", - "fee_paid": 100, + "fee_charged": 100, + "max_fee": 100, "operation_count": 1, "envelope_xdr": "AAAAADPAd4onmTZfBHs/PaBrzYzRCUHrCc1pudsAyZ7Wfv8XAAAAZAAKoyAAAAABAAAAAAAAAAEAAAAQMkExVjZKNTcwM0c0N1hIWQAAAAEAAAABAAAAADPAd4onmTZfBHs/PaBrzYzRCUHrCc1pudsAyZ7Wfv8XAAAAAQAAAADMSEvcRKXsaUNna++Hy7gWm/CfqTjEA7xoGypfrFGUHAAAAAAAAAAAhFKDAAAAAAAAAAAB1n7/FwAAAEBJdXuYg13Glzx1RinVCXd/cc1usrhU/0f5HFZ7lyIR8kS3T6PRrW78TQDNqXz+ukUiPwlB1A8MqxoW/SAL5FIB", "result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAA=", @@ -194,7 +196,8 @@ resource](../resources/transaction.md) for reference. "created_at": "2019-04-09T20:14:25Z", "source_account": "GABRMXDIJCTDSMPC67J64NSAMWRSYXVCXYTXVFC73DTHBKELHNKWANXP", "source_account_sequence": "122518237256298", - "fee_paid": 100, + "fee_charged": 100, + "max_fee": 100, "operation_count": 1, "envelope_xdr": "AAAAAAMWXGhIpjkx4vfT7jZAZaMsXqK+J3qUX9jmcKiLO1VgAAAAZAAAb24AAppqAAAAAQAAAAAAAAAAAAAAAFys/kkAAAABAAAABVdIQUxFAAAAAAAAAQAAAAAAAAAAAAAAAKrN4k6edFMb0WEyPzEEjWUAji0pvvALw+BAH4OnekA5AAAAAAcnDgAAAAAAAAAAAYs7VWAAAABAYd9uIm+TjIcAjTU90YJoNg/r+6PU3Uss7ewUb1w3yMa+HyoSvDq8sDz/SYmDBH7F+0ACIeBF4kkVEKVBJMh0AQ==", "result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=", diff --git a/services/horizon/internal/docs/reference/endpoints/transactions-single.md b/services/horizon/internal/docs/reference/endpoints/transactions-single.md index 60da18880b..da48891b2f 100644 --- a/services/horizon/internal/docs/reference/endpoints/transactions-single.md +++ b/services/horizon/internal/docs/reference/endpoints/transactions-single.md @@ -89,7 +89,8 @@ This endpoint responds with a single Transaction. See [transaction resource](.. "created_at": "2019-04-09T20:14:25Z", "source_account": "GAIH3ULLFQ4DGSECF2AR555KZ4KNDGEKN4AFI4SU2M7B43MGK3QJZNSR", "source_account_sequence": "4660039994869", - "fee_paid": 100, + "fee_charged": 100, + "max_fee": 100, "operation_count": 1, "envelope_xdr": "AAAAABB90WssODNIgi6BHveqzxTRmIpvAFRyVNM+Hm2GVuCcAAAAZAAABD0AB031AAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAFIMRkFZ9gZifhRSlklQpsz/9P04Earv0dzS3MkIM1cYAAAAXSHboAAAAAAAAAAABhlbgnAAAAEA+biIjrDy8yi+SvhFElIdWGBRYlDscnSSHkPchePy2JYDJn4wvJYDBumXI7/NmttUey3+cGWbBFfnnWh1H5EoD", "result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=", diff --git a/services/horizon/internal/docs/reference/resources/transaction.md b/services/horizon/internal/docs/reference/resources/transaction.md index db4aa80ef4..e77b5542e7 100644 --- a/services/horizon/internal/docs/reference/resources/transaction.md +++ b/services/horizon/internal/docs/reference/resources/transaction.md @@ -20,7 +20,8 @@ To learn more about the concept of transactions in the Stellar network, take a l | created_at | ISO8601 string | | | source_account | string | | | source_account_sequence | string | | -| fee_paid | number | The fee paid by the source account of this transaction when the transaction was applied to the ledger. | +| max_fee | number | The the maximum fee the source account was willing to pay. | +| fee_charged | number | The fee paid by the source account of this transaction when the transaction was applied to the ledger. | | operation_count | number | The number of operations that are contained within this transaction. | | envelope_xdr | string | A base64 encoded string of the raw `TransactionEnvelope` xdr struct for this transaction | | result_xdr | string | A base64 encoded string of the raw `TransactionResult` xdr struct for this transaction | @@ -81,7 +82,8 @@ To learn more about the concept of transactions in the Stellar network, take a l "created_at": "2019-02-21T21:44:13Z", "source_account": "GCDLRUXOD6KA53G5ILL435TZAISNLPS4EKIHSOVY3MVD3DVJ333NO4DT", "source_account_sequence": "10105916313567234", - "fee_paid": 100, + "max_fee": 100, + "fee_charged":100, "operation_count": 1, "envelope_xdr": "AAAAAIa40u4flA7s3ULXzfZ5AiTVvlwikHk6uNsqPY6p3vbXAAAAZAAj50cAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAB2Fmc2RmYXMAAAAAAQAAAAAAAAABAAAAAIa40u4flA7s3ULXzfZ5AiTVvlwikHk6uNsqPY6p3vbXAAAAAAAAAAEqBfIAAAAAAAAAAAGp3vbXAAAAQKElK3CoNo1f8fWIGeJm98lw2AaFiyVVFhx3uFok0XVW3MHV9MubtEhfA+n1iLPrxmzHtHfmZsumWk+sOEQlSwI=", "result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAA=", diff --git a/services/horizon/internal/resourceadapter/operations_test.go b/services/horizon/internal/resourceadapter/operations_test.go index e6c12dd449..0bef78daba 100644 --- a/services/horizon/internal/resourceadapter/operations_test.go +++ b/services/horizon/internal/resourceadapter/operations_test.go @@ -64,5 +64,6 @@ func TestPopulateOperation_WithTransaction(t *testing.T) { PopulateBaseOperation(ctx, &dest, operationsRow, &transactionRow, ledger) assert.True(t, dest.TransactionSuccessful) assert.True(t, dest.Transaction.Successful) - assert.Equal(t, int32(100), dest.Transaction.FeePaid) + assert.Equal(t, int32(100), dest.Transaction.FeeCharged) + assert.Equal(t, int32(10000), dest.Transaction.MaxFee) } diff --git a/services/horizon/internal/resourceadapter/transaction.go b/services/horizon/internal/resourceadapter/transaction.go index ec38f9d54c..9f9a93b5a4 100644 --- a/services/horizon/internal/resourceadapter/transaction.go +++ b/services/horizon/internal/resourceadapter/transaction.go @@ -32,7 +32,6 @@ func PopulateTransaction( dest.LedgerCloseTime = row.LedgerCloseTime dest.Account = row.Account dest.AccountSequence = row.AccountSequence - dest.FeePaid = row.FeeCharged dest.FeeCharged = row.FeeCharged dest.MaxFee = row.MaxFee diff --git a/services/horizon/internal/resourceadapter/transaction_test.go b/services/horizon/internal/resourceadapter/transaction_test.go index 31b099f089..d8ac7ecc92 100644 --- a/services/horizon/internal/resourceadapter/transaction_test.go +++ b/services/horizon/internal/resourceadapter/transaction_test.go @@ -53,5 +53,6 @@ func TestPopulateTransaction_Fee(t *testing.T) { row = history.Transaction{MaxFee: 10000, FeeCharged: 100} PopulateTransaction(ctx, &dest, row) - assert.Equal(t, int32(100), dest.FeePaid) + assert.Equal(t, int32(100), dest.FeeCharged) + assert.Equal(t, int32(10000), dest.MaxFee) } From 848c2e4e0d66bc21e5962483fe7f9aa3e0ba123f Mon Sep 17 00:00:00 2001 From: tamirms Date: Fri, 11 Oct 2019 13:52:08 +0300 Subject: [PATCH 2/2] Update services/horizon/CHANGELOG.md Co-Authored-By: Bartek Nowotarski --- services/horizon/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/horizon/CHANGELOG.md b/services/horizon/CHANGELOG.md index 06e9acd526..f74467f816 100644 --- a/services/horizon/CHANGELOG.md +++ b/services/horizon/CHANGELOG.md @@ -8,6 +8,8 @@ bumps. A breaking change will get clearly notified in this log. ## v0.23.0 +### Breaking Changes + * Remove deprecated `fee_paid` field on Transaction resource. Please use new fields added in 0.18.0: `max_fee` that defines the maximum fee the source account is willing to pay and `fee_charged` that defines the fee that was actually paid for a transaction. See [CAP-0005](https://github.com/stellar/stellar-protocol/blob/master/core/cap-0005.md) for more information. ## v0.22.1