Skip to content
This repository was archived by the owner on Nov 6, 2021. It is now read-only.

Commit f8c48ae

Browse files
committed
Merged in dev (pull request #11)
Documentation
2 parents 75b6c92 + 32908ac commit f8c48ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+5840
-347
lines changed

ReadMe.md

Lines changed: 29 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -94,186 +94,32 @@ The configuration file contains the basic network information, along with the fu
9494
mint Mint batches of Cardano non-fungible tokens.
9595
script Construct a minting script and compute its Policy ID.
9696
transact Submit Cardano metadata or mint Cardano tokens.
97-
98-
99-
### Encoding and decoding Bech32 text
100-
101-
102-
#### Encoding
103-
104-
$ mantis bech32-decode --help
105-
106-
Usage: mantis bech32-decode BECH32
107-
Decode a Bech32 string.
108-
109-
Available options:
110-
BECH32 The Bech32 text.
111-
-h,--help Show this help text
112-
113-
#### Decoding
114-
115-
$ mantis bech32-encode --help
116-
117-
Usage: mantis bech32-encode PREFIX DATA
118-
Encode a Bech32 string.
119-
120-
Available options:
121-
PREFIX The human-readable part.
122-
DATA The data part.
123-
-h,--help Show this help text
124-
125-
126-
### Computing the Bech32 fingerprint of a token
127-
128-
$ mantis fingerprint --help
129-
130-
Usage: mantis fingerprint POLICY_ID ASSET_NAME
131-
Compute the Bech32 fingerprint of a token.
132-
133-
Available options:
134-
POLICY_ID Policy ID for the token.
135-
ASSET_NAME Asset name for the token.
136-
-h,--help Show this help text
137-
138-
139-
### Download information from all blocks and transactions
140-
141-
142-
#### Download scripts from blockchain
143-
144-
Usage: mantis chain-scripts CONFIG_FILE [--output OUTPUT_DIR]
145-
Download scripts used as transaction witnesses.
146-
147-
Available options:
148-
CONFIG_FILE Path to configuration file.
149-
--output OUTPUT_DIR Output directory for script files.
150-
-h,--help Show this help text
151-
152-
153-
### Show information about a transaction file or address
154-
155-
156-
#### Addresses
157-
158-
$ mantis info-address --help
159-
Usage: mantis info-address [ADDRESS]
160-
Print information about addresses.
161-
162-
Available options:
163-
ADDRESS Shelley address.
164-
-h,--help Show this help text
165-
166-
167-
#### Transaction files
168-
169-
$ mantis info-tx --help
170-
171-
Usage: mantis info-tx [TX_FILE]
172-
Print contents of transaction files.
173-
174-
Available options:
175-
TX_FILE Signed transaction file.
176-
-h,--help Show this help text
177-
178-
179-
#### Transaction body files
180-
181-
$ mantis info-txbody --help
182-
Usage: mantis info-txbody [TXBODY_FILE]
183-
Print contents of transaction body files.
184-
185-
Available options:
186-
TXBODY_FILE Transaction body file.
187-
-h,--help Show this help text
188-
189-
190-
#### UTxOs
191-
192-
$ mantis info-utxo --help
193-
Usage: mantis info-utxo CONFIG_FILE [ADDRESS]
194-
Print UTxO information for addresses.
195-
196-
Available options:
197-
CONFIG_FILE Path to configuration file.
198-
ADDRESS Shelley address.
199-
-h,--help Show this help text
200-
201-
202-
### Construct a minting script and compute its Policy ID
203-
204-
$ mantis script --help
205-
206-
Usage: mantis script CONFIG_FILE [--expires SLOT] [--script SCRIPT_FILE]
207-
Construct a minting script and compute its Policy ID.
208-
209-
Available options:
210-
CONFIG_FILE Path to configuration file.
211-
--expires SLOT Slot number after which tokens are not mintable /
212-
burnable; prefix `+` if relative to tip.
213-
--script SCRIPT_FILE Path to output script JSON file.
214-
-h,--help Show this help text
215-
216-
217-
### Submit Cardano metadata or mint Cardano tokens
218-
219-
$ mantis transact --help
220-
221-
Usage: mantis transact CONFIG_FILE [TOKEN] [--count INTEGER] [--expires SLOT]
222-
[--output ADDRESS] [--script SCRIPT_FILE]
223-
[--metadata METADATA_FILE]
224-
Submit Cardano metadata or mint Cardano tokens.
225-
226-
Available options:
227-
CONFIG_FILE Path to configuration file.
228-
TOKEN Name of token to mint or burn.
229-
--count INTEGER Number of tokens to mint or burn.
230-
--expires SLOT Slot number after which tokens are not mintable /
231-
burnable; prefix `+` if relative to tip.
232-
--output ADDRESS Address for output of transaction.
233-
--script SCRIPT_FILE Path to output script JSON file.
234-
--metadata METADATA_FILE Path to metadata JSON file.
235-
-h,--help Show this help text
236-
237-
238-
### Mint batches of Cardano non-fungible tokens.
239-
240-
$ mantis mint --help
241-
242-
Usage: mantis mint CONFIG_FILE MINTING_FILE [--expires SLOT] [--output ADDRESS]
243-
[--script SCRIPT_FILE] [--metadata METADATA_FILE]
244-
Mint batches of Cardano non-fungible tokens.
245-
246-
Available options:
247-
CONFIG_FILE Path to configuration file.
248-
MINTING_FILE Path to minting JSON file.
249-
--expires SLOT Slot number after which tokens are not mintable /
250-
burnable; prefix `+` if relative to tip.
251-
--output ADDRESS Address for output of transaction.
252-
--script SCRIPT_FILE Path to output script JSON file.
253-
--metadata METADATA_FILE Path to output metadata JSON file.
254-
-h,--help Show this help text
255-
256-
The `MINTING_FILE` must be a JSON-formatted object with keys equal to the asset names and values equal to the metadata for that asset. For example, the JSON below will mint two NFTs with commonly used metadata tags, though there is no requirement to use particular tags:
257-
258-
{
259-
"First Token" : {
260-
"name" : "First Token"
261-
, "description" : "A first example token
262-
, "ticker" : "TOK-1"
263-
, "copyright" : "(c) 2021 My Name"
264-
, "image" : "ipfs://QmSLFyen7pmtU5wGRwQbjbB5b8c5RKqCzidjbDGnc9ddVV"
265-
, "logo" : "ipfs://QmYb4fMh2ceGwZtkFo97XLznJn2A5BjsxcB5BZpUCgf1ab"
266-
, "policy" : "ipfs://Qme7QmpUJnyEEuqmNWvAMAzu3H3RTUxF4LgmiiuCQ2WRry"
267-
, "id" : "asset1q6nqcr0ynrvqf4ml5n70j87gc7rrh0hsl40peg"
268-
},
269-
"Second Token" : {
270-
"name" : "Second Token"
271-
, "description" : "A second example token
272-
, "ticker" : "TOK-2"
273-
, "copyright" : "(c) 2021 My Name"
274-
, "image" : "ipfs://Qmcb3dyCuNQCj4KkeC8BXBkWX9ToNC3aAtpGTYzG9BMxHi"
275-
, "logo" : "ipfs://QmTzYgJExTjD6nsD6uXthPD6mtkqyzEwt8wxsaWjnwTMR6"
276-
, "policy" : "ipfs://Qme7QmpUJnyEEuqmNWvAMAzu3H3RTUxF4LgmiiuCQ2WRry"
277-
, "id" : "asset13dd0e3hyd94vf2cae0d36xxyqgecz4t5wcxutn"
278-
}
279-
}
97+
watch-address Watch transactions at an address.
98+
watch-coin Watch transactions for a coin.
99+
100+
* [Mint batches of Cardano non-fungible tokens](man/mint.md)
101+
* `mantis mint`
102+
* [Submit Cardano metadata or mint Cardano tokens](man/transact.md)
103+
* `mantis transact`
104+
* [Construct a minting script and compute its Policy ID](man/script.md)
105+
* `mantis script`
106+
* [Download information from all blocks and transactions](man/watch.md)
107+
* `mantis chain-scripts`
108+
* `mantis watch-address`
109+
* `mantis watch-coin`
110+
* [Encoding and decoding Bech32 text](man/bech32.md)
111+
* `mantis bech32-decode`
112+
* `mantis bech32-encode`
113+
* [Computing the Bech32 fingerprint of a token](man/fingerprint.md)
114+
* `mantis fingerprint`
115+
* [Show information about a transaction file or address](man/info.md)
116+
* `mantis info-address`
117+
* `mantis info-tx`
118+
* `mantis info-txbody`
119+
* `mantis info-utxo`
120+
121+
122+
API documentation
123+
-----------------
124+
125+
See https://functionally.github.io/mantis/ for API documentation.

app/Mantis/Command.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import qualified Mantis.Command.Info as Info
2020
import qualified Mantis.Command.Mint as Mint
2121
import qualified Mantis.Command.Script as Script
2222
import qualified Mantis.Command.Transact as Transact
23+
import qualified Mantis.Command.Watch as Watch
2324
import qualified Options.Applicative as O
2425

2526

@@ -52,6 +53,7 @@ main version =
5253
<> Mint.command
5354
<> Script.command
5455
<> Transact.command
56+
<> Watch.command
5557
)
5658
)
5759
)
@@ -83,7 +85,9 @@ main version =
8385
InfoTx{..} -> Info.mainTx printer txFiles
8486
Bech32Decode{..} -> Bech32.mainDecode printer bech32
8587
Bech32Encode{..} -> Bech32.mainEncode printer humanReadablePart dataPart
86-
Chain{..} -> Chain.main printer' configFile outputDirectory
88+
Chain{..} -> Chain.main printer' configFile outputDirectory continue
89+
WatchAddress{..} -> Watch.mainAddress printer' configFile addresses continue
90+
WatchCoin{..} -> Watch.mainCoin printer' configFile policyId assetName' continue
8791
case result of
8892
Right () -> return ()
8993
Left e -> hPutStrLn stderr e >> exitFailure

app/Mantis/Command/Chain.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,19 @@ command =
3131
options :: O.Parser Mantis
3232
options =
3333
Chain
34-
<$> O.strArgument ( O.metavar "CONFIG_FILE" <> O.help "Path to configuration file." )
35-
<*> O.optional (O.strOption $ O.long "output" <> O.metavar "OUTPUT_DIR" <> O.help "Output directory for script files.")
34+
<$> O.strArgument ( O.metavar "CONFIG_FILE" <> O.help "Path to configuration file." )
35+
<*> O.optional (O.strOption $ O.long "output" <> O.metavar "OUTPUT_DIR" <> O.help "Output directory for script files." )
36+
<*> O.switch ( O.long "continue" <> O.help "Whether to continue when the current tip of the chain is reached.")
3637

3738

3839
main :: MonadFail m
3940
=> MonadIO m
4041
=> (String -> IO ())
4142
-> FilePath
4243
-> Maybe FilePath
44+
-> Bool
4345
-> MantisM m ()
44-
main debugIO configFile output =
46+
main debugIO configFile output continue =
4547
do
4648
Configuration{..} <- liftIO $ read <$> readFile configFile
4749

@@ -51,7 +53,7 @@ main debugIO configFile output =
5153
liftIO $ debugIO ""
5254
liftIO . debugIO $ "Network: " ++ show network
5355

54-
extractScripts socketPath protocol network
56+
extractScripts socketPath protocol network (return $ not continue)
5557
$ \(BlockHeader slotNo _ _) tx hash script ->
5658
do
5759
let

app/Mantis/Command/Types.hs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,19 @@ data Mantis =
8383
{
8484
configFile :: FilePath
8585
, outputDirectory :: Maybe FilePath
86+
, continue :: Bool
87+
}
88+
| WatchAddress
89+
{
90+
configFile :: FilePath
91+
, addresses :: [String]
92+
, continue :: Bool
93+
}
94+
| WatchCoin
95+
{
96+
configFile :: FilePath
97+
, policyId :: String
98+
, assetName' :: Maybe String
99+
, continue :: Bool
86100
}
87101
deriving (Eq, Ord, Read, Show)

0 commit comments

Comments
 (0)