Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
71 additions
and
14 deletions.
There are no files selected for viewing
27 changes: 21 additions & 6 deletions
27
marlowe-runtime/cli/Language/Marlowe/Runtime/CLI/Command/Apply.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,37 @@ | ||
{-# LANGUAGE ExistentialQuantification #-} | ||
|
||
module Language.Marlowe.Runtime.CLI.Command.Apply | ||
where | ||
|
||
import Language.Marlowe (POSIXTime) | ||
import Language.Marlowe.Runtime.CLI.Command.Tx (TxCommand) | ||
import Language.Marlowe.Runtime.CLI.Monad (CLI) | ||
import Language.Marlowe.Runtime.Core.Api (ContractId, IsMarloweVersion(Redeemer), MarloweVersion) | ||
import Options.Applicative | ||
|
||
data ApplyCommand | ||
data ApplyCommand = forall v. ApplyCommand | ||
{ contractId :: ContractId | ||
, marloweVersion :: MarloweVersion v | ||
, inputs :: ContractInputs v | ||
, validityLowerBound :: Maybe POSIXTime | ||
, validityUpperBound :: Maybe POSIXTime | ||
} | ||
|
||
data ContractInputs v | ||
= ContractInputsByFile FilePath | ||
| ContractInputsByValue (Redeemer v) | ||
|
||
applyCommandParser :: ParserInfo ApplyCommand | ||
applyCommandParser :: ParserInfo (TxCommand ApplyCommand) | ||
applyCommandParser = info empty $ progDesc "Apply inputs to a contract" | ||
|
||
depositCommandParser :: ParserInfo ApplyCommand | ||
depositCommandParser :: ParserInfo (TxCommand ApplyCommand) | ||
depositCommandParser = info empty $ progDesc "Deposit funds into a contract" | ||
|
||
chooseCommandParser :: ParserInfo ApplyCommand | ||
chooseCommandParser :: ParserInfo (TxCommand ApplyCommand) | ||
chooseCommandParser = info empty $ progDesc "Make a choice in a contract" | ||
|
||
notifyCommandParser :: ParserInfo ApplyCommand | ||
notifyCommandParser :: ParserInfo (TxCommand ApplyCommand) | ||
notifyCommandParser = info empty $ progDesc "Notify a contract to proceed" | ||
|
||
runApplyCommand :: ApplyCommand -> CLI () | ||
runApplyCommand :: TxCommand ApplyCommand -> CLI () | ||
runApplyCommand = error "not implemented" |
28 changes: 25 additions & 3 deletions
28
marlowe-runtime/cli/Language/Marlowe/Runtime/CLI/Command/Create.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,35 @@ | ||
module Language.Marlowe.Runtime.CLI.Command.Create | ||
where | ||
|
||
import Data.Map (Map) | ||
import Language.Marlowe (POSIXTime) | ||
import Language.Marlowe.Runtime.CLI.Command.Tx (TxCommand) | ||
import Language.Marlowe.Runtime.CLI.Monad (CLI) | ||
import Language.Marlowe.Runtime.ChainSync.Api (Address, TokenName) | ||
import Language.Marlowe.Runtime.Core.Api (SomeMarloweVersion) | ||
import Options.Applicative | ||
|
||
data CreateCommand | ||
data CreateCommand = CreateCommand | ||
{ marloweVersion :: SomeMarloweVersion | ||
, roles :: Map TokenName Address | ||
, contractFiles :: ContractFiles | ||
} | ||
|
||
createCommandParser :: ParserInfo CreateCommand | ||
data ContractFiles | ||
= CoreFile FilePath | ||
| ExtendedFiles FilePath ContractArgs | ||
|
||
data ContractArgs | ||
= ContractArgsByFile FilePath | ||
| ContractArgsByValue ContractArgsValue | ||
|
||
data ContractArgsValue = ContractArgsValue | ||
{ timeoutArguments :: Map String POSIXTime | ||
, valueArguments :: Map String Integer | ||
} | ||
|
||
createCommandParser :: ParserInfo (TxCommand CreateCommand) | ||
createCommandParser = info empty $ progDesc "Create a new Marlowe Contract" | ||
|
||
runCreateCommand :: CreateCommand -> CLI () | ||
runCreateCommand :: TxCommand CreateCommand -> CLI () | ||
runCreateCommand = error "not implemented" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
marlowe-runtime/cli/Language/Marlowe/Runtime/CLI/Command/Tx.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Language.Marlowe.Runtime.CLI.Command.Tx | ||
where | ||
|
||
import Language.Marlowe.Runtime.Transaction.Api (WalletAddresses) | ||
|
||
data TxCommand cmd = TxCommand | ||
{ walletAddresses :: WalletAddresses | ||
, signingMethod :: SigningMethod | ||
, subCommand :: cmd | ||
} | ||
|
||
data SigningMethod | ||
= Manual |
12 changes: 9 additions & 3 deletions
12
marlowe-runtime/cli/Language/Marlowe/Runtime/CLI/Command/Withdraw.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
module Language.Marlowe.Runtime.CLI.Command.Withdraw | ||
where | ||
|
||
import Language.Marlowe.Runtime.CLI.Command.Tx (TxCommand) | ||
import Language.Marlowe.Runtime.CLI.Monad (CLI) | ||
import Language.Marlowe.Runtime.ChainSync.Api (TokenName) | ||
import Language.Marlowe.Runtime.Core.Api (ContractId) | ||
import Options.Applicative | ||
|
||
data WithdrawCommand | ||
data WithdrawCommand = WithdrawCommand | ||
{ contractId :: ContractId | ||
, role :: TokenName | ||
} | ||
|
||
withdrawCommandParser :: ParserInfo WithdrawCommand | ||
withdrawCommandParser :: ParserInfo (TxCommand WithdrawCommand) | ||
withdrawCommandParser = info empty $ progDesc "Withdraw funds paid to a role in a contract" | ||
|
||
runWithdrawCommand :: WithdrawCommand -> CLI () | ||
runWithdrawCommand :: TxCommand WithdrawCommand -> CLI () | ||
runWithdrawCommand = error "not implemented" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters