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

Payment construction endpoint #2702

Merged
merged 41 commits into from
Jul 1, 2021

Conversation

paweljakubas
Copy link
Contributor

@paweljakubas paweljakubas commented Jun 10, 2021

Issue Number

adp-909

Overview

  • POST transactions/construct in swagger
  • Api.Types reflecting things added in swagger
  • add Api skeleton
  • unit tests for Api.Types, Malformed
  • extend Transaction interface by adding mkUnsignedTransaction
  • fill in implementation of Cardano.Api.Server and Cardano-Wallet function implementing 'payments' functionality
  • prepare first integration testing

Comments

@paweljakubas paweljakubas requested a review from rvl June 10, 2021 12:16
@paweljakubas paweljakubas self-assigned this Jun 10, 2021
, withdrawal :: !(Maybe ApiWithdrawalPostData)
, metadata :: !(Maybe (ApiT TxMetadata))
, mint :: !(Maybe (ApiT W.TokenMap))
, delegation :: ![ApiMultiDelegationAction]
Copy link
Contributor Author

@paweljakubas paweljakubas Jun 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Anviking does it make sense? see ApiMultiDelegationAction - Natural will stand for soft index of stake key. Thanks to that we could in one tx realize several join/leave pool actions. Maybe it could help with portfolio recreation, reduce needed roundtrips, etc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think [ApiMultiDelegationAction] as a raw/manual/low-level kind of multi-delegation api would be really nice. Joining (ApiT PoolId) Natural makes sense to me.

But instead of Leaving (ApiT PoolId), we should presumably have Leaving Natural. We don't have to specify a pool id when we de-register a stake key, but we do need to know which stake key we want to deregister.

And I think we currently use the terminology Join and Quit, so why not stick to it?

Copy link
Member

@Anviking Anviking Jun 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I just realised I didn't plan for the DelegationState to validate (several) user-provided multi-delegation actions, but it would be nice to support, and I don't see how it could be problematic.)

But it does mean that, as said, the delegation actions need to be validated by the DelegationState eventually.

And for now, I guess you would have to start with only supporting key 0 or maybe even a single action, when implementing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the look. Now I have :

data ApiMultiDelegationAction = Joining (ApiT PoolId) Natural | Leaving Natural

@paweljakubas paweljakubas force-pushed the paweljakubas/adp-909/payment-construction branch 3 times, most recently from 997ac09 to 0d2184a Compare June 18, 2021 18:17
@paweljakubas paweljakubas changed the title Payment construction and fee endpoints Payment construction endpoint Jun 21, 2021
@paweljakubas paweljakubas force-pushed the paweljakubas/adp-909/payment-construction branch from 87efd4f to 60fc62e Compare June 22, 2021 11:04
@paweljakubas paweljakubas marked this pull request as ready for review June 22, 2021 15:37
@paweljakubas paweljakubas force-pushed the paweljakubas/adp-909/payment-construction branch from c5ebf05 to fc1d4be Compare June 22, 2021 15:40
Copy link
Contributor

@rvl rvl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @paweljakubas

Comment on lines 647 to 648
(notSupported "Byron")
(notSupported "Shared")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps add a TODO: ADP-909 comment or something - These wallet types should be supported in the final version.

Comment on lines 1948 to 1950
let toAddressAmount (ApiPaymentAddresses content) =
addressAmountToTxOut <$> content
toAddressAmount (ApiPaymentAll _) = undefined -- this will be tackled when migration is supported
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make sure our app doesn't implode when the user finds an implemented feature.
Can we use HTTP 501 instead of undefined or error, wherever possible?

Suggested change
let toAddressAmount (ApiPaymentAddresses content) =
addressAmountToTxOut <$> content
toAddressAmount (ApiPaymentAll _) = undefined -- this will be tackled when migration is supported
let toAddressAmount (ApiPaymentAddresses content) = pure (addressAmountToTxOut <$> content)
toAddressAmount (ApiPaymentAll _) = liftE ErrTemporarilyDisabled -- TODO: this will be tackled when migration is supported

{ txWithdrawal = wdrl
, txMetadata = md
, txTimeToLive = ttl
--, txDelegationAction -- this will be tackled when delegations are supported
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
--, txDelegationAction -- this will be tackled when delegations are supported
, txDelegationAction = Nothing -- TODO: ADP-909 this will be tackled when delegations are supported

pure (mkApiCoinSelection [] Nothing md sel', fee, blob)

let txSerialized = ApiSerialisedTransaction (ApiBytesT $ convertToBase Base64 blob)
pure $ ApiConstructTransaction txSerialized apiSelection (Quantity $ fromIntegral fee)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nicer if there were a separate:

mkApiConstructTransaction :: sel -> fee -> Either ErrMkTx ApiConstructTransaction

Currently W.constructUnsignedTransaction is getting the reward account XPrv, but only the XPub is necessary for the TxBody, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, in the end XPub is needed.

, withdrawal :: !(Maybe ApiWithdrawalPostData)
, metadata :: !(Maybe (ApiT TxMetadata))
, mint :: !(Maybe (ApiT W.TokenMap))
, delegations :: !(Maybe [ApiMultiDelegationAction])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forget, why did we have Maybe [ApiMultiDelegationAction] here?
Was there a semantic difference between Nothing and Just []?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is reasonable to use delegations: Maybe ... as it can be optional on Api level, one can omit "delegations" field.. I will use Maybe (NonEmpty ApiMultiDelegationAction) though

Copy link
Member

@Anviking Anviking Jun 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from arguably looking a bit strange, wouldn't Maybe (NonEmpty ApiMultiDelegationAction) forbid "delegations" = [], potentially making it more difficult for folks to write API clients?

Could we not have delegations :: [ApiMultiDelegationAction], but have a custom JSON parser defaulting to [] if the key is not present?

... if we even need to allow it to be omitted?

, mkUnsignedTransaction
:: AnyCardanoEra
-- Era for which the transaction should be created.
-> XPrv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think only an XPub is needed here, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, used XPub rather than XPrv

-> (Maybe Cardano.TxMetadata, [Cardano.Certificate])
-> SlotNo
-- ^ Slot at which the transaction will expire.
-> XPrv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-> XPrv
-> RewardAccount

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -1006,6 +1022,14 @@ x-transactionOutputs: &transactionOutputs
amount: *amount
assets: *walletAssets

x-transactionNoAmountOutputs: &transactionNoAmountOutputs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't this extra declaration should be necessary.
It's just an array of addresses.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it is used here :

2686     ApiPaymentDestination: &ApiPaymentDestination                                                                                                                                                             
2687       oneOf:                                                                                                                                                                                                  
2688         - title: outputs with specified amounts                                                                                                                                                               
2689           <<: *transactionOutputs                                                                                                                                                                             
2690         - title: outputs without amounts                                                                                                                                                                      
2691           <<: *transactionNoAmountOutputs

and in contrast to transactionOutputs it does not include amount and assets as we want to use it in migration. So how to capture migration output here?

Comment on lines 1130 to 1139
type: object
required:
- action
- stake_key_index
properties:
action:
type: string
enum: ["quit", "join"]
pool: *stakePoolId
stake_key_index: *derivationSegment
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of this way? I like it more.

Suggested change
type: object
required:
- action
- stake_key_index
properties:
action:
type: string
enum: ["quit", "join"]
pool: *stakePoolId
stake_key_index: *derivationSegment
oneOf:
- type: object
required:
- join
properties:
join:
type: object
required:
- pool
- stake_key_index
properties:
pool: *stakePoolId
stake_key_index: *derivationSegment
- type: object
required:
- quit
properties:
quit:
type: object
required:
- stake_key_index
properties:
stake_key_index: *derivationSegment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it is better. Adopted

Comment on lines +2679 to +2694
required:
- invalid_before
- invalid_hereafter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would want the Haskell validity bound type to stay the same, but in JSON, the bounds should be optional, with a missing key meaning "unspecified".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we have at this moment :

2693     ApiConstructTransactionData: &ApiConstructTransactionData                                                                                                                                                 
2694       type: object                                                                                                                                                                                            
2695       required:                                                                                                                                                                                               
2696         - passphrase                                                                                                                                                                                          
2697       properties:                                                                                                                                                                                             
2698         passphrase:                                                                                                                                                                                           
2699           <<: *lenientPassphrase                                                                                                                                                                              
2700           description: The wallet's master passphrase.                                                                                                                                                        
2701         payments: *ApiPaymentDestination                                                                                                                                                                      
2702         withdrawal: *transactionWithdrawalRequestSelf                                                                                                                                                         
2703         metadata: *transactionMetadata                                                                                                                                                                        
2704         mint: *transactionMint                                                                                                                                                                                
2705         delegations: *transactionDelegations                                                                                                                                                                  
2706         validity_interval: *ApiValidityInterval

so the idea was to sneak optionality by making validity_interval optional, but make ApiValidityInterval well defined. kinda the same as for ApiPaymentDestination - the same idea...Once again I do not have strong opinion about this, could be either way, but maybe it would be ok to be consistent..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the JSON side, we want an omitted field to mean unspecified bound.

@paweljakubas paweljakubas force-pushed the paweljakubas/adp-909/payment-construction branch from fc1d4be to 590c35f Compare June 25, 2021 15:27
@paweljakubas paweljakubas requested a review from rvl June 27, 2021 18:21
it "TRANS_NEW_CREATE_01x - Single Output Transaction" $ \ctx -> runResourceT $ do
let initialAmt = 3*minUTxOValue
wa <- fixtureWalletWith @n ctx [initialAmt]
wb <- fixtureWalletWith @n ctx [initialAmt]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be emptyWallet I guess.

post:
operationId: postTransactionConstruct
tags: ["Transactions"]
summary: Create
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
summary: Create
summary: Construct

?

@piotr-iohk
Copy link
Contributor

piotr-iohk commented Jun 28, 2021

Currently in the API we have only passphrase being required payload parameter.
I guess we want also one of payments or delegations to be required?

Screenshot from 2021-06-28 10-42-23

EDIT: Do we need passphrase after all at the payment construction step as signing will be done in subsequent step?

Copy link
Contributor

@rvl rvl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. I still have a few comments though, and have also pushed some minor changes.

, selectionToUnsignedTx
, signTransaction
, constructUnsignedTransaction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just call this constructTransaction

constructUnsignedTransaction ctx wid mkRwdAcct pwd txCtx sel =
db & \DBLayer{..} -> do
era <- liftIO $ currentNodeEra nl
withRootKey @_ @s ctx wid pwd ErrConstructTxWithRootKey $ \xprv scheme -> do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we aren't signing anything then we shouldn't need the wallet root key.
We should be able to get rewardAcct from the database using readRewardAccount.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -323,6 +331,7 @@ byronTransactionClient =
, postExternalTransaction = _postExternalTransaction
, deleteTransaction = _deleteTransaction
, getTransaction = _getTransaction
, constructTransaction = error "TODO should be supported in the final version of Transaction Workflow."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
, constructTransaction = error "TODO should be supported in the final version of Transaction Workflow."
, constructTransaction = error "TODO ADP-909 implement new transaction API for all wallet types."

@@ -633,6 +634,21 @@ getTransaction w t = discriminate @style
tid = ApiTxId (t ^. typed @(ApiT (Hash "Tx")))
mkURL mk = mk wid tid

createUnsignedTransaction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
createUnsignedTransaction
createTransaction

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately, there is already createTransaction

toJSON = genericToJSON defaultRecordTypeOptions

instance ToJSON ApiValidityBound where
toJSON ApiValidityBoundUnspecified = String "unspecified"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to use Null I think.

Comment on lines 2009 to 1999
(Just joinObj, Nothing) -> do
poolId <- joinObj .: "pool"
ix <- joinObj .: "stake_key_index"
pure $ Joining poolId ix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(Just joinObj, Nothing) -> do
poolId <- joinObj .: "pool"
ix <- joinObj .: "stake_key_index"
pure $ Joining poolId ix
(Just o, Nothing) -> Joining <$> o .: "pool" <*> o .: "stake_key_index"

Comment on lines 2013 to 2002
(Nothing, Just quitObj) -> do
ix <- quitObj .: "stake_key_index"
pure $ Leaving ix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(Nothing, Just quitObj) -> do
ix <- quitObj .: "stake_key_index"
pure $ Leaving ix
(Nothing, Just o) -> Leaving <$> o .: "stake_key_index"

(Nothing, Just quitObj) -> do
ix <- quitObj .: "stake_key_index"
pure $ Leaving ix
_ -> fail "ApiMultiDelegationAction needs 'join' or 'quit' field"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_ -> fail "ApiMultiDelegationAction needs 'join' or 'quit' field"
_ -> fail "ApiMultiDelegationAction needs either 'join' or 'quit', but not both"

pure ApiValidityBoundUnspecified
else
fail "invalid string of ApiValidityBound"
processObject = withObject "ApiValidityBound object" $ \o -> do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be possible try parsing the Quantities directly without testing the "unit" field.

Comment on lines +2679 to +2694
required:
- invalid_before
- invalid_hereafter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the JSON side, we want an omitted field to mean unspecified bound.

@piotr-iohk
Copy link
Contributor

Currently in swagger only passphrase is marked as required parameter (afaiu it is required for getting reward account), however I think that we need also at least one of payments, delegations or mint to be there as well. It would be nice to express this in swagger somehow (not sure how as at least one of the mentioned fields is required also).

Anyway, one can currently set just passphrase in the request and it seems that in such case the payment is constructed, which seems rather bad:

$ curl -X POST http://localhost:8090/v2/wallets/23b218fd80907f03f4ce4bc138eb3131e08dc0f8/transactions-construct \
-d '{"passphrase":"Secure Passphrase"}' \
-H "Content-Type: application/json" | jq

{
  "fee": {
    "quantity": 2166293,
    "unit": "lovelace"
  },
  "serialized_transaction": "ZzZRQWdZSllJQnowL2pTajFYNmhLbzdDaXNDNEdrTWhhTEZBRC9NSDlrd1BQUDlGUVFFMEFBR0JnbGc1QUluL3h1TUJFRS81UkNGdHhIeTQxb1lZTno0aDhjVmd1azRSQUsxTTRFajFSMHN4bTlFVlpPZENoaGFycXFmU3BVN0UzUEVLWDBiOEdnQjNpSEVDR2dBaERoVURHZ0hVam5pZi8vWT0=",
  "coin_selection": {
    "withdrawals": [],
    "inputs": [
      {
        "amount": {
          "quantity": 10000006,
          "unit": "lovelace"
        },
        "address": "addr_test1qqph473hczdyrk9c9te8qh3xd6gfug604800r4rxt82a2njvupy0236txxdaz9tyuapgv94t42na9f2wcnw0zzjlgm7qw40nap",
        "id": "8b59d852cbf65fad4897eeffaa32ff09ae8c9b382dc042b436425b6e91cc77ee",
        "derivation_path": [
          "1852H",
          "1815H",
          "0H",
          "0",
          "22"
        ],
        "assets": [],
        "index": 0
      }
    ],
    "deposits": [],
    "change": [
      {
        "amount": {
          "quantity": 7833713,
          "unit": "lovelace"
        },
        "address": "addr_test1qzyll3hrqygyl72yy9kugl9c66rpsde7y8cu2c96fcgspt2vupy0236txxdaz9tyuapgv94t42na9f2wcnw0zzjlgm7qp0g974",
        "derivation_path": [
          "1852H",
          "1815H",
          "0H",
          "1",
          "0"
        ],
        "assets": []
      }
    ],
    "outputs": []
  }
}

It seems that one full utxo is selected and "spent" to one of the wallet's own addresses...
Checked on rev 2df0c15.

@rvl
Copy link
Contributor

rvl commented Jul 1, 2021

In the case where the user didn't provide any of payments, delegations or mint, I'm not sure whether we need to disallow it - as long as the result is a valid transaction. Perhaps a user would like to post a transaction with nothing but metadata?

@piotr-iohk
Copy link
Contributor

In the case where the user didn't provide any of payments, delegations or mint, I'm not sure whether we need to disallow it - as long as the result is a valid transaction. Perhaps a user would like to post a transaction with nothing but metadata?

That would also incur fees + minUtxoValue, so in fact (at least) a payment, right?
I guess it's possible to send metadata with mint or delegation too, but at least one of the payment/delegation/mint would be needed.

@paweljakubas paweljakubas force-pushed the paweljakubas/adp-909/payment-construction branch from 2df0c15 to b27561a Compare July 1, 2021 12:39
@paweljakubas
Copy link
Contributor Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jul 1, 2021
2702: Payment construction endpoint r=paweljakubas a=paweljakubas

# Issue Number

<!-- Put here a reference to the issue that this PR relates to and which requirements it tackles. Jira issues of the form ADP- will be auto-linked. -->
adp-909

# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [x] POST transactions/construct in swagger
- [x] Api.Types reflecting things added in swagger
- [x] add Api skeleton
- [x] unit tests for Api.Types, Malformed
- [x] extend Transaction interface by adding mkUnsignedTransaction
- [x] fill in implementation of Cardano.Api.Server and Cardano-Wallet function implementing 'payments' functionality
- [x] prepare first integration testing




# Comments

<!-- Additional comments or screenshots to attach if any -->

<!--
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding ticket
 ✓ Acknowledge any changes required to the Wiki
 ✓ Finally, in the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages.
-->


Co-authored-by: Pawel Jakubas <[email protected]>
Co-authored-by: Rodney Lorrimar <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 1, 2021

Build failed:

cardano-wallet                 >   src/Test/Integration/Scenario/API/Shared/Wallets.hs:973:19:
--
  | cardano-wallet                 >   1) API Specifications, SHARED_WALLETS, SHARED_WALLETS_LIST_01 - Wallets are listed from oldest to newest
  | cardano-wallet                 >        expected: Status {statusCode = 201, statusMessage = "Created"}
  | cardano-wallet                 >         but got: Status {statusCode = 500, statusMessage = "Internal Server Error"}
  | cardano-wallet                 >
  | cardano-wallet                 >        from the following response: Left (DecodeFailure "{\"code\":\"unexpected_error\",\"message\":\"That's embarrassing. Your wallet looks good, but I couldn't open a new database to store its data. This is unexpected and likely not your fault. Perhaps, check your filesystem's permissions or available space?\"}")
  | cardano-wallet                 >
  | cardano-wallet                 >        While verifying value:
  | cardano-wallet                 >          ( Status
  | cardano-wallet                 >              { statusCode = 500
  | cardano-wallet                 >              , statusMessage = "Internal Server Error"
  | cardano-wallet                 >              }
  | cardano-wallet                 >          , Left
  | cardano-wallet                 >              ( DecodeFailure "{"code":"unexpected_error","message":"That's embarrassing. Your wallet looks good, but I couldn't open a new database to store its data. This is unexpected and likely not your fault. Perhaps, check your filesystem's permissions or available space?"}" )
  | cardano-wallet                 >          )
  | cardano-wallet                 >
  | cardano-wallet                 >   To rerun use: --match "/API Specifications/SHARED_WALLETS/SHARED_WALLETS_LIST_01 - Wallets are listed from oldest to newest/"


@paweljakubas
Copy link
Contributor Author

bors retry

iohk-bors bot added a commit that referenced this pull request Jul 1, 2021
2702: Payment construction endpoint r=paweljakubas a=paweljakubas

# Issue Number

<!-- Put here a reference to the issue that this PR relates to and which requirements it tackles. Jira issues of the form ADP- will be auto-linked. -->
adp-909

# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [x] POST transactions/construct in swagger
- [x] Api.Types reflecting things added in swagger
- [x] add Api skeleton
- [x] unit tests for Api.Types, Malformed
- [x] extend Transaction interface by adding mkUnsignedTransaction
- [x] fill in implementation of Cardano.Api.Server and Cardano-Wallet function implementing 'payments' functionality
- [x] prepare first integration testing




# Comments

<!-- Additional comments or screenshots to attach if any -->

<!--
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding ticket
 ✓ Acknowledge any changes required to the Wiki
 ✓ Finally, in the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages.
-->


Co-authored-by: Pawel Jakubas <[email protected]>
Co-authored-by: Rodney Lorrimar <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 1, 2021

Build failed:

 src/Test/Integration/Framework/DSL.hs:2280:7:
  1) API Specifications, SHELLEY_STAKE_POOLS, STAKE_POOLS_JOIN_01rewards - Can join a pool, earn rewards and collect them
       expected a successful response but got an error: DecodeFailure "{\"code\":\"created_invalid_transaction\",\"message\":\"That's embarrassing. It looks like I've created an invalid transaction that could not be parsed by the node. Here's an error message that may help with debugging: HardForkApplyTxErrFromEra S (S (S (Z (WrapApplyTxErr {unwrapApplyTxErr = ApplyTxError [DelegsFailure (WithdrawalsNotInRewardsDELEGS (fromList [(RewardAcnt {getRwdNetwork = Mainnet, getRwdCred = KeyHashObj (KeyHash \\\"83df2d49188a828575e0efa8faf2b9a5f5a6f740d6216e6554564497\\\")},Coin 122807086201)]))]}))))\"}"
       While verifying value:
         ( Status
             { statusCode = 500
             , statusMessage = "Internal Server Error"
             }
         , Left
             ( DecodeFailure "{"code":"created_invalid_transaction","message":"That's embarrassing. It looks like I've created an invalid transaction that could not be parsed by the node. Here's an error message that may help with debugging: HardForkApplyTxErrFromEra S (S (S (Z (WrapApplyTxErr {unwrapApplyTxErr = ApplyTxError [DelegsFailure (WithdrawalsNotInRewardsDELEGS (fromList [(RewardAcnt {getRwdNetwork = Mainnet, getRwdCred = KeyHashObj (KeyHash \"83df2d49188a828575e0efa8faf2b9a5f5a6f740d6216e6554564497\")},Coin 122807086201)]))]}))))"}" )
         )

  To rerun use: --match "/API Specifications/SHELLEY_STAKE_POOLS/STAKE_POOLS_JOIN_01rewards - Can join a pool, earn rewards and collect them/"

#2779

@paweljakubas
Copy link
Contributor Author

bors retry

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 1, 2021

Build succeeded:

@iohk-bors iohk-bors bot merged commit bfaec3b into master Jul 1, 2021
@iohk-bors iohk-bors bot deleted the paweljakubas/adp-909/payment-construction branch July 1, 2021 18:32
WilliamKingNoel-Bot pushed a commit that referenced this pull request Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants