Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to horizon 0.18.0 wip #27

Merged
merged 6 commits into from
Jul 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions StellarQtSDK.pri
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ INCLUDEPATH *= $$PWD/src/
SOURCES += \
$$PWD/src/account.cpp \
$$PWD/src/accountmergeoperation.cpp \
$$PWD/src/createpassivesellofferoperation.cpp \
$$PWD/src/managebuyofferoperation.cpp \
$$PWD/src/managesellofferoperation.cpp \
$$PWD/src/operation.cpp \
$$PWD/src/keypair.cpp \
$$PWD/src/allowtrustoperation.cpp \
Expand All @@ -30,7 +33,11 @@ SOURCES += \
$$PWD/src/assettypenative.cpp \
$$PWD/src/changetrustoperation.cpp \
$$PWD/src/createaccountoperation.cpp \
$$PWD/src/createpassiveofferoperation.cpp \
$$PWD/src/requests/feestatsrequestbuilder.cpp \
$$PWD/src/responses/feestatsresponse.cpp \
$$PWD/src/responses/operations/bumpsequenceoperationresponse.cpp \
$$PWD/src/responses/operations/managebuyofferoperationresponse.cpp \
$$PWD/src/responses/operations/managesellofferoperationresponse.cpp \
$$PWD/src/strkey.cpp \
$$PWD/src/inflationoperation.cpp \
$$PWD/src/util.cpp \
Expand Down Expand Up @@ -89,8 +96,6 @@ SOURCES += \
$$PWD/src/managedataoperation.cpp \
$$PWD/src/responses/operations/managedataoperationresponse.cpp \
$$PWD/src/responses/operations/setoptionsoperationresponse.cpp \
$$PWD/src/manageofferoperation.cpp \
$$PWD/src/responses/operations/manageofferoperationresponse.cpp \
$$PWD/xdr/stellartransaction.cpp \
$$PWD/src/requests/tradesrequestbuilder.cpp \
$$PWD/src/responses/traderesponse.cpp \
Expand Down Expand Up @@ -135,8 +140,6 @@ SOURCES += \
$$PWD/src/requests/rootrequestbuilder.cpp \
$$PWD/src/bumpsequenceoperation.cpp \
$$PWD/src/timebounds.cpp \
$$PWD/src/requests/operationfeestatsrequestbuilder.cpp \
$$PWD/src/responses/operationfeestatsresponse.cpp \
$$PWD/src/slip10.cpp

# The following define makes your compiler emit warnings if you use
Expand All @@ -151,6 +154,14 @@ DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

HEADERS += \
$$PWD/src/createpassivesellofferoperation.h \
$$PWD/src/managebuyofferoperation.h \
$$PWD/src/managesellofferoperation.h \
$$PWD/src/requests/feestatsrequestbuilder.h \
$$PWD/src/responses/feestatsresponse.h \
$$PWD/src/responses/operations/bumpsequenceoperationresponse.h \
$$PWD/src/responses/operations/managebuyofferoperationresponse.h \
$$PWD/src/responses/operations/managesellofferoperationresponse.h \
$$PWD/xdr/stellartypes.h \
$$PWD/src/account.h \
$$PWD/src/transactionbuilderaccount.h \
Expand All @@ -165,7 +176,6 @@ HEADERS += \
$$PWD/src/assettypenative.h \
$$PWD/src/changetrustoperation.h \
$$PWD/src/createaccountoperation.h \
$$PWD/src/createpassiveofferoperation.h \
$$PWD/src/strkey.h \
$$PWD/src/inflationoperation.h \
$$PWD/src/util.h \
Expand Down Expand Up @@ -224,8 +234,6 @@ HEADERS += \
$$PWD/src/managedataoperation.h \
$$PWD/src/responses/operations/managedataoperationresponse.h \
$$PWD/src/responses/operations/setoptionsoperationresponse.h \
$$PWD/src/manageofferoperation.h \
$$PWD/src/responses/operations/manageofferoperationresponse.h \
$$PWD/src/requests/tradesrequestbuilder.h \
$$PWD/src/responses/traderesponse.h \
$$PWD/src/responses/pathresponse.h \
Expand Down Expand Up @@ -270,8 +278,6 @@ HEADERS += \
$$PWD/src/requests/rootrequestbuilder.h \
$$PWD/src/bumpsequenceoperation.h \
$$PWD/src/timebounds.h \
$$PWD/src/requests/operationfeestatsrequestbuilder.h \
$$PWD/src/responses/operationfeestatsresponse.h \
$$PWD/src/slip10.h

#to maintain it easier, until we dont support more than read FEDERATION_SERVER address, we dont use CPPTOML
Expand Down
2 changes: 1 addition & 1 deletion StellarQtSDKTest.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ include(StellarQtSDK.pri)

HEADERS += \
test/keypairtest.h \
test/responses/feestatsdeserializertest.h \
test/strkeytest.h \
test/testcollector.h \
test/operationtest.h \
Expand Down Expand Up @@ -63,7 +64,6 @@ HEADERS += \
test/responses/rootdeserializertest.h \
test/requests/rootrequestbuildtest.h \
test/requests/operationfeerequestbuildertest.h \
test/responses/operationfeestatsdeserializertest.h \
test/sep0005keypairforaccountfrombip39seedtest.h \
test/slip0010ed25519privatekeytest.h

Expand Down
84 changes: 0 additions & 84 deletions src/createpassiveofferoperation.cpp

This file was deleted.

71 changes: 0 additions & 71 deletions src/createpassiveofferoperation.h

This file was deleted.

84 changes: 84 additions & 0 deletions src/createpassivesellofferoperation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#include "createpassivesellofferoperation.h"
#include "asset.h"
#include "price.h"

CreatePassiveSellOfferOperation::CreatePassiveSellOfferOperation(Asset *selling, Asset *buying, QString amount, QString price)
:m_selling(nullptr)
,m_buying(nullptr)
{
checkNotNull(selling, "selling cannot be null");
checkNotNull(buying, "buying cannot be null");
checkNotNull(amount, "amount cannot be null");
checkNotNull(price, "price cannot be null");

m_op.selling = selling->toXdr();
m_op.buying = buying->toXdr();
m_op.amount = Operation::toXdrAmount(amount);
m_op.price = Price(price).toXdr();
}

CreatePassiveSellOfferOperation::~CreatePassiveSellOfferOperation()
{
if(m_selling)
delete m_selling;
if(m_buying)
delete m_buying;
}

CreatePassiveSellOfferOperation::CreatePassiveSellOfferOperation(stellar::CreatePassiveSellOfferOp &op)
:m_selling(nullptr)
,m_buying(nullptr)
,m_op(op)
{

}

Asset *CreatePassiveSellOfferOperation::getSelling() {
if(!m_selling){
m_selling= Asset::fromXdr(m_op.selling);
}
return m_selling;
}

Asset *CreatePassiveSellOfferOperation::getBuying() {
if(!m_buying){
m_buying= Asset::fromXdr(m_op.buying);
}
return m_buying;
}

QString CreatePassiveSellOfferOperation::getAmount() {
return Operation::fromXdrAmount(m_op.amount);;
}

QString CreatePassiveSellOfferOperation::getPrice() {
return Price::toString(m_op.price.n,m_op.price.d);;
}

void CreatePassiveSellOfferOperation::fillOperationBody(stellar::Operation &operation)
{
operation.type = stellar::OperationType::CREATE_PASSIVE_SELL_OFFER;
operation.operationCreatePassiveSellOffer = m_op;
}

CreatePassiveSellOfferOperation *CreatePassiveSellOfferOperation::build(stellar::CreatePassiveSellOfferOp &op)
{
return new CreatePassiveSellOfferOperation(op);
}

CreatePassiveSellOfferOperation *CreatePassiveSellOfferOperation::create(Asset* selling, Asset* buying, QString amount, QString price)
{
return new CreatePassiveSellOfferOperation(selling, buying, amount, price);
}

CreatePassiveSellOfferOperation *CreatePassiveSellOfferOperation::setSourceAccount(KeyPair *sourceAccount)
{
Operation::setSourceAccount(sourceAccount);
return this;
}

CreatePassiveSellOfferOperation *CreatePassiveSellOfferOperation::setSourceAccount(KeyPair &sourceAccount)
{
Operation::setSourceAccount(new KeyPair(sourceAccount));
return this;
}
Loading