Skip to content

Commit

Permalink
add types and endpoint in core
Browse files Browse the repository at this point in the history
  • Loading branch information
paweljakubas committed Oct 20, 2021
1 parent 8950866 commit 530fcf6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/core/src/Cardano/Wallet/Api.hs
Expand Up @@ -61,6 +61,7 @@ module Cardano.Wallet.Api
, CreateTransactionOld
, PostTransactionFeeOld
, BalanceTransaction
, SubmitTransaction

, StakePools
, ListStakePools
Expand Down Expand Up @@ -528,6 +529,7 @@ type ShelleyTransactions n =
:<|> CreateTransactionOld n
:<|> PostTransactionFeeOld n
:<|> BalanceTransaction n
:<|> SubmitTransaction

-- | https://input-output-hk.github.io/cardano-wallet/api/#operation/constructTransaction
type ConstructTransaction n = "wallets"
Expand Down Expand Up @@ -588,6 +590,13 @@ type BalanceTransaction n = "wallets"
:> ReqBody '[JSON] (ApiBalanceTransactionPostDataT n)
:> PostAccepted '[JSON] ApiSerialisedTransaction

-- | https://input-output-hk.github.io/cardano-wallet/api/#operation/submitTransaction
type SubmitTransaction = "wallets"
:> Capture "walletId" (ApiT WalletId)
:> "transactions-submit"
:> ReqBody '[OctetStream] (ApiT SealedTx)
:> PostAccepted '[JSON] ApiTxId

{-------------------------------------------------------------------------------
Shelley Migrations
Expand Down
7 changes: 7 additions & 0 deletions lib/core/src/Cardano/Wallet/Api/Client.hs
Expand Up @@ -194,6 +194,10 @@ data TransactionClient = TransactionClient
:: ApiT WalletId
-> ApiBalanceTransactionPostDataT Aeson.Value
-> ClientM ApiSerialisedTransaction
, submitTransaction
:: ApiT WalletId
-> ApiT SealedTx
-> ClientM ApiTxId
}

data AddressClient = AddressClient
Expand Down Expand Up @@ -310,6 +314,7 @@ transactionClient =
:<|> _postTransaction
:<|> _postTransactionFee
:<|> _balanceTransaction
:<|> _submitTransaction
= client (Proxy @("v2" :> (ShelleyTransactions Aeson.Value)))

_postExternalTransaction
Expand All @@ -325,6 +330,7 @@ transactionClient =
, getTransaction = _getTransaction
, constructTransaction = _constructTransaction
, balanceTransaction = _balanceTransaction
, submitTransaction = _submitTransaction
}

fromSerialisedTx :: ApiBytesT base SerialisedTx -> ApiT SealedTx
Expand Down Expand Up @@ -357,6 +363,7 @@ byronTransactionClient =
, getTransaction = _getTransaction
, constructTransaction = _constructTransaction
, balanceTransaction = error "balance transaction endpoint not supported for byron"
, submitTransaction = error "submit transaction endpoint not supported for byron"
}

-- | Produces an 'AddressClient n' working against the /wallets API
Expand Down

0 comments on commit 530fcf6

Please sign in to comment.