morley-client-0.2.1: Client to interact with the Tezos blockchain
Safe HaskellSafe-Inferred
LanguageHaskell2010

Morley.Client.Util

Synopsis

Documentation

epNameToTezosEp :: EpName -> Text Source #

Convert EpName to the textual representation used by RPC and tezos-client.

extractAddressesFromValue :: Value -> [Address] Source #

Extract all addresses value from given untyped Value.

Note that it returns all values that can be used as an address. However, some of fetched values can never be used as an address.

disableAlphanetWarning :: IO () Source #

Sets the environment variable for disabling tezos-client "not a mainnet" warning

runContract

runContract :: forall cp st m. (HasTezosRpc m, StorageScope st) => RunContractParameters cp st -> m (AsRPC (Value st)) Source #

Run contract with given parameter and storage and get new storage without injecting anything to the chain.

data RunContractParameters cp st Source #

A structure with all the parameters for runContract

Constructors

RunContractParameters 

Fields

  • rcpContract :: Contract cp st
     
  • rcpParameter :: Value

    The parameter value should have the same "structure" as cp, except it _may_ also have big_map IDs. E.g. if the contract's parameter is pair (big_map string string) (big_map string string), then rcpParameter may be one of:

    • pair (big_map string string) (big_map string string)
    • pair nat (big_map string string)
    • pair (big_map string string) nat
    • pair nat nat

    ... where nat represents a big_map ID.

  • rcpStorage :: Value

    The storage value should have the same "structure" as st, except it _may_ also have big_map IDs. See the documentation of rcpParameter.

  • rcpBalance :: Mutez
     
  • rcpNow :: Maybe Timestamp
     
  • rcpLevel :: Maybe Natural
     
  • rcpAmount :: Mutez
     
  • rcpSender :: Maybe ImplicitAddress
     
  • rcpSource :: Maybe ImplicitAddress
     

runContractParameters :: (HasNoOp cp, HasNoOp st) => Contract cp st -> Value cp -> Value st -> RunContractParameters cp st Source #

Initializes the parameters for runContract with sensible defaults.

Use the with* lenses to set any optional parameters.

withBalance :: forall cp st. Lens' (RunContractParameters cp st) Mutez Source #

withAmount :: forall cp st. Lens' (RunContractParameters cp st) Mutez Source #

withSender :: forall cp st. Lens' (RunContractParameters cp st) (Maybe ImplicitAddress) Source #

withSource :: forall cp st. Lens' (RunContractParameters cp st) (Maybe ImplicitAddress) Source #

withNow :: forall cp st. Lens' (RunContractParameters cp st) (Maybe Timestamp) Source #

tezos-client password-related helpers

scrubbedBytesToString :: ScrubbedBytes -> String Source #

Convert ScrubbedBytes to String, so that it can be passed to tezos-client as a stdin

readScrubbedBytes :: MonadIO m => m ScrubbedBytes Source #

Function for relatively safe getting password from stdin. After reading bytes are converted to ScrubbedBytes, thus it's harder to accidentally leak them.