diff --git a/lib/core/src/Cardano/Wallet/Api.hs b/lib/core/src/Cardano/Wallet/Api.hs index c6a0f1f6c1e..411619471ab 100644 --- a/lib/core/src/Cardano/Wallet/Api.hs +++ b/lib/core/src/Cardano/Wallet/Api.hs @@ -61,6 +61,7 @@ module Cardano.Wallet.Api , CreateTransactionOld , PostTransactionFeeOld , BalanceTransaction + , SubmitTransaction , StakePools , ListStakePools @@ -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" @@ -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 diff --git a/lib/core/src/Cardano/Wallet/Api/Client.hs b/lib/core/src/Cardano/Wallet/Api/Client.hs index 812ba8b7d94..9dbbc7c7276 100644 --- a/lib/core/src/Cardano/Wallet/Api/Client.hs +++ b/lib/core/src/Cardano/Wallet/Api/Client.hs @@ -194,6 +194,10 @@ data TransactionClient = TransactionClient :: ApiT WalletId -> ApiBalanceTransactionPostDataT Aeson.Value -> ClientM ApiSerialisedTransaction + , submitTransaction + :: ApiT WalletId + -> ApiT SealedTx + -> ClientM ApiTxId } data AddressClient = AddressClient @@ -310,6 +314,7 @@ transactionClient = :<|> _postTransaction :<|> _postTransactionFee :<|> _balanceTransaction + :<|> _submitTransaction = client (Proxy @("v2" :> (ShelleyTransactions Aeson.Value))) _postExternalTransaction @@ -325,6 +330,7 @@ transactionClient = , getTransaction = _getTransaction , constructTransaction = _constructTransaction , balanceTransaction = _balanceTransaction + , submitTransaction = _submitTransaction } fromSerialisedTx :: ApiBytesT base SerialisedTx -> ApiT SealedTx @@ -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