diff --git a/glide.lock b/glide.lock index 42ab474cd..3aaf1c72b 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 3e5f125dc8eba7cd579904822cc559c6343e2e7011297debcff3ef42aa07b9f3 -updated: 2020-02-14T16:34:33.546987-08:00 +hash: c591adad92b29f8f741d3fe2774f7cc4a9b96eca8f0be1bff204b7401d4d900e +updated: 2020-02-17T13:58:42.430704-05:00 imports: - name: cloud.google.com/go version: 83a0b8742b4d7302c26d3b71bfdcbd9224f6b951 @@ -143,7 +143,7 @@ imports: - name: github.com/spf13/viper version: 01d7d76eb0020ae2fd1275899065ddfdd9f6a528 - name: github.com/stellar/go - version: 6fed6295e962ee8c3798de6c18eccd48f418a8fe + version: 009cb26a4013ccd023c0a6c57a72e709a5dc82cf repo: git@github.com:nikhilsaraf/go.git vcs: git subpackages: diff --git a/glide.yaml b/glide.yaml index 82bc55c2a..9a311ad64 100644 --- a/glide.yaml +++ b/glide.yaml @@ -11,7 +11,7 @@ import: - package: github.com/stellar/go repo: git@github.com:nikhilsaraf/go.git vcs: git - version: horizonclient-v2.0.0/2_max_fee_stats + version: horizonclient-v2.0.0/3_fix_txnbuild_delete_offer_op subpackages: - build - clients/horizonclient diff --git a/plugins/sdex.go b/plugins/sdex.go index 64b2c03d0..f0776f082 100644 --- a/plugins/sdex.go +++ b/plugins/sdex.go @@ -199,10 +199,12 @@ func (sdex *SDEX) DeleteAllOffers(offers []hProtocol.Offer) []txnbuild.Operation func (sdex *SDEX) DeleteOffer(offer hProtocol.Offer) txnbuild.ManageSellOffer { var result txnbuild.ManageSellOffer var e error + + txOffer := utils.Offer2TxnBuildSellOffer(offer) if sdex.SourceAccount == sdex.TradingAccount { - result, e = txnbuild.DeleteOfferOp(offer.ID) + result, e = txnbuild.DeleteOfferOp2(txOffer) } else { - result, e = txnbuild.DeleteOfferOp(offer.ID, &txnbuild.SimpleAccount{AccountID: sdex.TradingAccount}) + result, e = txnbuild.DeleteOfferOp2(txOffer, &txnbuild.SimpleAccount{AccountID: sdex.TradingAccount}) } if e != nil { diff --git a/support/utils/functions.go b/support/utils/functions.go index 84d7e9557..253b2cf17 100644 --- a/support/utils/functions.go +++ b/support/utils/functions.go @@ -402,3 +402,14 @@ func ParseMaybeFloat(valueString string) (*float64, error) { } return &valueFloat, nil } + +// Offer2TxnBuildSellOffer converts an hProtocol.Offer to a txnbuild.ManageSellOffer +func Offer2TxnBuildSellOffer(offer hProtocol.Offer) txnbuild.ManageSellOffer { + return txnbuild.ManageSellOffer{ + Selling: Asset2Asset(offer.Selling), + Buying: Asset2Asset(offer.Buying), + Amount: offer.Amount, + Price: offer.Price, + OfferID: offer.ID, + } +}